19517SBill.Taylor@Sun.COM /* 29517SBill.Taylor@Sun.COM * CDDL HEADER START 39517SBill.Taylor@Sun.COM * 49517SBill.Taylor@Sun.COM * The contents of this file are subject to the terms of the 59517SBill.Taylor@Sun.COM * Common Development and Distribution License (the "License"). 69517SBill.Taylor@Sun.COM * You may not use this file except in compliance with the License. 79517SBill.Taylor@Sun.COM * 89517SBill.Taylor@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 99517SBill.Taylor@Sun.COM * or http://www.opensolaris.org/os/licensing. 109517SBill.Taylor@Sun.COM * See the License for the specific language governing permissions 119517SBill.Taylor@Sun.COM * and limitations under the License. 129517SBill.Taylor@Sun.COM * 139517SBill.Taylor@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 149517SBill.Taylor@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159517SBill.Taylor@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 169517SBill.Taylor@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 179517SBill.Taylor@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 189517SBill.Taylor@Sun.COM * 199517SBill.Taylor@Sun.COM * CDDL HEADER END 209517SBill.Taylor@Sun.COM */ 219517SBill.Taylor@Sun.COM 229517SBill.Taylor@Sun.COM /* 23*12965SWilliam.Taylor@Oracle.COM * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 249517SBill.Taylor@Sun.COM */ 259517SBill.Taylor@Sun.COM 269517SBill.Taylor@Sun.COM #ifndef _SYS_IB_ADAPTERS_HERMON_MR_H 279517SBill.Taylor@Sun.COM #define _SYS_IB_ADAPTERS_HERMON_MR_H 289517SBill.Taylor@Sun.COM 299517SBill.Taylor@Sun.COM /* 309517SBill.Taylor@Sun.COM * hermon_mr.h 319517SBill.Taylor@Sun.COM * Contains all of the prototypes, #defines, and structures necessary 329517SBill.Taylor@Sun.COM * for the Hermon Memory Region/Window routines. 339517SBill.Taylor@Sun.COM * Specifically it contains #defines, macros, and prototypes for each of 349517SBill.Taylor@Sun.COM * the required memory region/window verbs that can be accessed through 359517SBill.Taylor@Sun.COM * the IBTF's CI interfaces. In particular each of the prototypes defined 369517SBill.Taylor@Sun.COM * below is called from a corresponding CI interface routine (as specified 379517SBill.Taylor@Sun.COM * in the hermon_ci.c file). 389517SBill.Taylor@Sun.COM */ 399517SBill.Taylor@Sun.COM 409517SBill.Taylor@Sun.COM #include <sys/types.h> 419517SBill.Taylor@Sun.COM #include <sys/conf.h> 429517SBill.Taylor@Sun.COM #include <sys/ddi.h> 439517SBill.Taylor@Sun.COM #include <sys/sunddi.h> 449517SBill.Taylor@Sun.COM 459517SBill.Taylor@Sun.COM #ifdef __cplusplus 469517SBill.Taylor@Sun.COM extern "C" { 479517SBill.Taylor@Sun.COM #endif 489517SBill.Taylor@Sun.COM 499517SBill.Taylor@Sun.COM /* 509517SBill.Taylor@Sun.COM * The following defines specify the default number of MPT entries to 519517SBill.Taylor@Sun.COM * configure. This value is controllable through the "hermon_log_num_mpt" 529517SBill.Taylor@Sun.COM * configuration variable. 539517SBill.Taylor@Sun.COM */ 549517SBill.Taylor@Sun.COM #define HERMON_NUM_DMPT_SHIFT 0x16 559517SBill.Taylor@Sun.COM 569517SBill.Taylor@Sun.COM /* 579517SBill.Taylor@Sun.COM * The following defines specify the default number of MPT entries to 589517SBill.Taylor@Sun.COM * configure. This value is controllable through the "hermon_log_num_mtt" 599517SBill.Taylor@Sun.COM * configuration variable. This default value expects an averages of 8 609517SBill.Taylor@Sun.COM * MTTs per MPT. We also define a log MTT size, since it's not likely 619517SBill.Taylor@Sun.COM * to change. 629517SBill.Taylor@Sun.COM */ 63*12965SWilliam.Taylor@Oracle.COM #define HERMON_NUM_MTT_SHIFT 0x1d 649517SBill.Taylor@Sun.COM #define HERMON_MTT_SIZE_SHIFT 0x3 659517SBill.Taylor@Sun.COM 669517SBill.Taylor@Sun.COM /* 679517SBill.Taylor@Sun.COM * This define is the maximum size of a memory region or window (log 2), which 689517SBill.Taylor@Sun.COM * is used to initialize the "hermon_log_max_mrw_sz" configuration variable. 699517SBill.Taylor@Sun.COM */ 709517SBill.Taylor@Sun.COM #define HERMON_MAX_MEM_MPT_SHIFT 0x24 719517SBill.Taylor@Sun.COM 729517SBill.Taylor@Sun.COM /* 739517SBill.Taylor@Sun.COM * Defines used by hermon_mr_deregister() to specify how much/to what extent 749517SBill.Taylor@Sun.COM * a given memory regions resources should be freed up. HERMON_MR_DEREG_ALL 759517SBill.Taylor@Sun.COM * says what it means, free up all the resources associated with the region. 769517SBill.Taylor@Sun.COM * HERMON_MR_DEREG_NO_HW2SW_MPT indicates that it is unnecessary to attempt 779517SBill.Taylor@Sun.COM * the ownership transfer (from hardware to software) for the given MPT entry. 789517SBill.Taylor@Sun.COM * And HERMON_MR_DEREG_NO_HW2SW_MPT_OR_UNBIND indicates that it is not only 799517SBill.Taylor@Sun.COM * unnecessary to attempt the ownership transfer for MPT, but it is also 809517SBill.Taylor@Sun.COM * unnecessary to attempt to unbind the memory. 819517SBill.Taylor@Sun.COM * In general, these last two are specified when hermon_mr_deregister() is 829517SBill.Taylor@Sun.COM * called from hermon_mr_reregister(), where the MPT ownership transfer or 839517SBill.Taylor@Sun.COM * memory unbinding may have already been successfully performed. 849517SBill.Taylor@Sun.COM */ 859517SBill.Taylor@Sun.COM #define HERMON_MR_DEREG_ALL 3 869517SBill.Taylor@Sun.COM #define HERMON_MR_DEREG_NO_HW2SW_MPT 2 879517SBill.Taylor@Sun.COM #define HERMON_MR_DEREG_NO_HW2SW_MPT_OR_UNBIND 1 889517SBill.Taylor@Sun.COM 899517SBill.Taylor@Sun.COM /* 909517SBill.Taylor@Sun.COM * The following define is used by hermon_mr_rereg_xlat_helper() to determine 919517SBill.Taylor@Sun.COM * whether or not a given DMA handle can be reused. If the DMA handle was 929517SBill.Taylor@Sun.COM * previously initialized for IOMMU bypass mapping, then it can not be reused 939517SBill.Taylor@Sun.COM * to reregister a region for DDI_DMA_STREAMING access. 949517SBill.Taylor@Sun.COM */ 959517SBill.Taylor@Sun.COM #define HERMON_MR_REUSE_DMAHDL(mr, flags) \ 969517SBill.Taylor@Sun.COM (((mr)->mr_bindinfo.bi_bypass != HERMON_BINDMEM_BYPASS) || \ 979517SBill.Taylor@Sun.COM !((flags) & IBT_MR_NONCOHERENT)) 989517SBill.Taylor@Sun.COM 999517SBill.Taylor@Sun.COM /* 1009517SBill.Taylor@Sun.COM * The hermon_sw_refcnt_t structure is used internally by the Hermon driver to 1019517SBill.Taylor@Sun.COM * track all the information necessary to manage shared memory regions. Since 1029517SBill.Taylor@Sun.COM * a shared memory region _will_ have its own distinct MPT entry, but will 1039517SBill.Taylor@Sun.COM * _share_ its MTT entries with another region, it is necessary to track the 1049517SBill.Taylor@Sun.COM * number of times a given MTT structure is shared. This ensures that it will 1059517SBill.Taylor@Sun.COM * not be prematurely freed up and that can be destroyed only when it is 1069517SBill.Taylor@Sun.COM * appropriate to do so. 1079517SBill.Taylor@Sun.COM * 1089517SBill.Taylor@Sun.COM * Each hermon_sw_refcnt_t structure contains a lock and a reference count 1099517SBill.Taylor@Sun.COM * variable which are used to track the necessary information. 1109517SBill.Taylor@Sun.COM * 1119517SBill.Taylor@Sun.COM * The following macros (below) are used to manipulate and query the MTT 1129517SBill.Taylor@Sun.COM * reference count parameters. HERMON_MTT_REFCNT_INIT() is used to initialize 1139517SBill.Taylor@Sun.COM * a newly allocated hermon_sw_refcnt_t struct (setting the "swrc_refcnt" to 1). 1149517SBill.Taylor@Sun.COM * And the HERMON_MTT_IS_NOT_SHARED() and HERMON_MTT_IS_SHARED() macros are 1159517SBill.Taylor@Sun.COM * used to query the current status of hermon_sw_refcnt_t struct to determine 1169517SBill.Taylor@Sun.COM * if its "swrc_refcnt" is one or not. 1179517SBill.Taylor@Sun.COM */ 1189517SBill.Taylor@Sun.COM typedef struct hermon_sw_refcnt_s { 1199517SBill.Taylor@Sun.COM kmutex_t swrc_lock; 1209517SBill.Taylor@Sun.COM uint_t swrc_refcnt; 1219517SBill.Taylor@Sun.COM } hermon_sw_refcnt_t; 1229517SBill.Taylor@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(hermon_sw_refcnt_t::swrc_refcnt)) 1239517SBill.Taylor@Sun.COM _NOTE(MUTEX_PROTECTS_DATA(hermon_sw_refcnt_t::swrc_lock, 1249517SBill.Taylor@Sun.COM hermon_sw_refcnt_t::swrc_refcnt)) 1259517SBill.Taylor@Sun.COM #define HERMON_MTT_REFCNT_INIT(swrc_tmp) ((swrc_tmp)->swrc_refcnt = 1) 1269517SBill.Taylor@Sun.COM #define HERMON_MTT_IS_NOT_SHARED(swrc_tmp) ((swrc_tmp)->swrc_refcnt == 1) 1279517SBill.Taylor@Sun.COM #define HERMON_MTT_IS_SHARED(swrc_tmp) ((swrc_tmp)->swrc_refcnt != 1) 1289517SBill.Taylor@Sun.COM 1299517SBill.Taylor@Sun.COM 1309517SBill.Taylor@Sun.COM /* 1319517SBill.Taylor@Sun.COM * The hermon_bind_info_t structure is used internally by the Hermon driver to 1329517SBill.Taylor@Sun.COM * track all the information necessary to perform the DMA mappings necessary 1339517SBill.Taylor@Sun.COM * for memory registration. It is specifically passed into both the 1349517SBill.Taylor@Sun.COM * hermon_mr_mem_bind() and hermon_mr_mtt_write() functions which perform most 1359517SBill.Taylor@Sun.COM * of the necessary operations for Hermon memory registration. 1369517SBill.Taylor@Sun.COM * 1379517SBill.Taylor@Sun.COM * This structure is used to pass all the information necessary for a call 1389517SBill.Taylor@Sun.COM * to either ddi_dma_addr_bind_handle() or ddi_dma_buf_bind_handle(). Note: 1399517SBill.Taylor@Sun.COM * the fields which need to be valid for each type of binding are slightly 1409517SBill.Taylor@Sun.COM * different and that it indicated by the value in the "bi_type" field. The 1419517SBill.Taylor@Sun.COM * "bi_type" field may be set to either of the following defined values: 1429517SBill.Taylor@Sun.COM * HERMON_BINDHDL_VADDR (to indicate an "addr" bind) or HERMON_BINDHDL_BUF (to 1439517SBill.Taylor@Sun.COM * indicate a "buf" bind). 1449517SBill.Taylor@Sun.COM * 1459517SBill.Taylor@Sun.COM * Upon return from hermon_mr_mem_bind(), the hermon_bind_info_t struct will 1469517SBill.Taylor@Sun.COM * have its "bi_dmahdl", "bi_dmacookie", and "bi_cookiecnt" fields filled in. 1479517SBill.Taylor@Sun.COM * It is these values which are of particular interest to the 1489517SBill.Taylor@Sun.COM * hermon_mr_mtt_write() routine (they hold the PCI mapped addresses). 1499517SBill.Taylor@Sun.COM * 1509517SBill.Taylor@Sun.COM * Once initialized and used in this way, the hermon_bind_info_t will not to be 1519517SBill.Taylor@Sun.COM * modified in anyway until it is subsequently passed to hermon_mr_mem_unbind() 1529517SBill.Taylor@Sun.COM * where the memory and resources will be unbound and reclaimed. Note: the 1539517SBill.Taylor@Sun.COM * "bi_free_dmahdl" flag indicated whether the ddi_dma_handle_t should be 1549517SBill.Taylor@Sun.COM * freed as part of the hermon_mr_mem_unbind() operation or whether it will 1559517SBill.Taylor@Sun.COM * be freed later elsewhere. 1569517SBill.Taylor@Sun.COM */ 1579517SBill.Taylor@Sun.COM typedef struct hermon_bind_info_s { 1589517SBill.Taylor@Sun.COM uint64_t bi_addr; 1599517SBill.Taylor@Sun.COM uint64_t bi_len; 1609517SBill.Taylor@Sun.COM struct as *bi_as; 1619517SBill.Taylor@Sun.COM struct buf *bi_buf; 1629517SBill.Taylor@Sun.COM ddi_dma_handle_t bi_dmahdl; 1639517SBill.Taylor@Sun.COM ddi_dma_cookie_t bi_dmacookie; 1649517SBill.Taylor@Sun.COM uint_t bi_cookiecnt; 1659517SBill.Taylor@Sun.COM uint_t bi_type; 1669517SBill.Taylor@Sun.COM uint_t bi_flags; 1679517SBill.Taylor@Sun.COM uint_t bi_bypass; 1689517SBill.Taylor@Sun.COM uint_t bi_free_dmahdl; 1699517SBill.Taylor@Sun.COM } hermon_bind_info_t; 1709517SBill.Taylor@Sun.COM #define HERMON_BINDHDL_NONE 0 1719517SBill.Taylor@Sun.COM #define HERMON_BINDHDL_VADDR 1 1729517SBill.Taylor@Sun.COM #define HERMON_BINDHDL_BUF 2 1739517SBill.Taylor@Sun.COM #define HERMON_BINDHDL_UBUF 3 174*12965SWilliam.Taylor@Oracle.COM #define HERMON_BINDHDL_LKEY 4 1759517SBill.Taylor@Sun.COM 1769517SBill.Taylor@Sun.COM /* 1779517SBill.Taylor@Sun.COM * The hermon_sw_mr_s structure is also referred to using the "hermon_mrhdl_t" 1789517SBill.Taylor@Sun.COM * typedef (see hermon_typedef.h). It encodes all the information necessary 1799517SBill.Taylor@Sun.COM * to track the various resources needed to register, reregister, deregister, 1809517SBill.Taylor@Sun.COM * and perform all the myriad other operations on both memory regions _and_ 1819517SBill.Taylor@Sun.COM * memory windows. 1829517SBill.Taylor@Sun.COM * 1839517SBill.Taylor@Sun.COM * A pointer to this structure is returned from many of the IBTF's CI verbs 1849517SBill.Taylor@Sun.COM * interfaces for memory registration. 1859517SBill.Taylor@Sun.COM * 1869517SBill.Taylor@Sun.COM * It contains pointers to the various resources allocated for a memory 1879517SBill.Taylor@Sun.COM * region, i.e. MPT resource, MTT resource, and MTT reference count resource. 1889517SBill.Taylor@Sun.COM * In addition it contains the hermon_bind_info_t struct used for the memory 1899517SBill.Taylor@Sun.COM * bind operation on a given memory region. 1909517SBill.Taylor@Sun.COM * 1919517SBill.Taylor@Sun.COM * It also has a pointers to the associated PD handle, placeholders for access 1929517SBill.Taylor@Sun.COM * flags, memory keys, and suggested page size for the region. It also has 1939517SBill.Taylor@Sun.COM * the necessary backpointer to the resource that corresponds to the structure 1949517SBill.Taylor@Sun.COM * itself. And lastly, it contains a placeholder for a callback which should 1959517SBill.Taylor@Sun.COM * be called on memory region unpinning. 1969517SBill.Taylor@Sun.COM */ 1979517SBill.Taylor@Sun.COM struct hermon_sw_mr_s { 1989517SBill.Taylor@Sun.COM kmutex_t mr_lock; 1999517SBill.Taylor@Sun.COM hermon_rsrc_t *mr_mptrsrcp; 2009517SBill.Taylor@Sun.COM hermon_rsrc_t *mr_mttrsrcp; 2019517SBill.Taylor@Sun.COM hermon_rsrc_t *mr_mttrefcntp; 2029517SBill.Taylor@Sun.COM hermon_pdhdl_t mr_pdhdl; 2039517SBill.Taylor@Sun.COM hermon_bind_info_t mr_bindinfo; 2049517SBill.Taylor@Sun.COM ibt_mr_attr_flags_t mr_accflag; 2059517SBill.Taylor@Sun.COM uint32_t mr_lkey; 2069517SBill.Taylor@Sun.COM uint32_t mr_rkey; 2079517SBill.Taylor@Sun.COM uint32_t mr_logmttpgsz; 2089517SBill.Taylor@Sun.COM hermon_mpt_rsrc_type_t mr_mpt_type; 2099517SBill.Taylor@Sun.COM uint64_t mr_mttaddr; /* for cMPTs */ 2109517SBill.Taylor@Sun.COM uint64_t mr_log2_pgsz; 2119517SBill.Taylor@Sun.COM /* entity_size (in bytes), for cMPTS */ 2129517SBill.Taylor@Sun.COM hermon_rsrc_t *mr_rsrcp; 2139517SBill.Taylor@Sun.COM uint_t mr_is_fmr; 21411972SBill.Taylor@Sun.COM uint8_t mr_fmr_key; /* per FMR 8-bit key */ 2159517SBill.Taylor@Sun.COM hermon_fmr_list_t *mr_fmr; 2169517SBill.Taylor@Sun.COM uint_t mr_is_umem; 2179517SBill.Taylor@Sun.COM ddi_umem_cookie_t mr_umemcookie; 2189517SBill.Taylor@Sun.COM void (*mr_umem_cbfunc)(void *, void *); 2199517SBill.Taylor@Sun.COM void *mr_umem_cbarg1; 2209517SBill.Taylor@Sun.COM void *mr_umem_cbarg2; 2219517SBill.Taylor@Sun.COM }; 2229517SBill.Taylor@Sun.COM _NOTE(DATA_READABLE_WITHOUT_LOCK(hermon_sw_mr_s::mr_bindinfo 2239517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_lkey 22411972SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_mttaddr 2259517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_is_umem 2269517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_is_fmr 2279517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_fmr)) 2289517SBill.Taylor@Sun.COM _NOTE(MUTEX_PROTECTS_DATA(hermon_sw_mr_s::mr_lock, 2299517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_mptrsrcp 2309517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_mttrsrcp 2319517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_mttrefcntp 2329517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_bindinfo 2339517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_lkey 2349517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_rkey 2359517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_logmttpgsz 2369517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_rsrcp 2379517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_is_umem 2389517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_umemcookie 2399517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_umem_cbfunc 2409517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_umem_cbarg1 2419517SBill.Taylor@Sun.COM hermon_sw_mr_s::mr_umem_cbarg2)) 2429517SBill.Taylor@Sun.COM 2439517SBill.Taylor@Sun.COM /* 2449517SBill.Taylor@Sun.COM * The hermon_mr_options_t structure is used in several of the Hermon memory 2459517SBill.Taylor@Sun.COM * registration routines to provide additional option functionality. When 2469517SBill.Taylor@Sun.COM * a NULL pointer is passed in place of a pointer to this struct, it is a 2479517SBill.Taylor@Sun.COM * way of specifying the "default" behavior. Using this structure, however, 2489517SBill.Taylor@Sun.COM * is a way of controlling any extended behavior. 2499517SBill.Taylor@Sun.COM * 2509517SBill.Taylor@Sun.COM * Currently, the only defined "extended" behaviors are for specifying whether 2519517SBill.Taylor@Sun.COM * a given memory region should bypass the PCI IOMMU (HERMON_BINDMEM_BYPASS) 2529517SBill.Taylor@Sun.COM * or be mapped into the IOMMU (HERMON_BINDMEM_NORMAL), for specifying whether 2539517SBill.Taylor@Sun.COM * a given ddi_dma_handle_t should be used in the bind operation, and for 2549517SBill.Taylor@Sun.COM * specifying whether a memory registration should attempt to return an IB 2559517SBill.Taylor@Sun.COM * vaddr which is "zero-based" (aids in alignment contraints for QPs). 2569517SBill.Taylor@Sun.COM * 2579517SBill.Taylor@Sun.COM * This defaults today to always bypassing the IOMMU (can be changed by using 2589517SBill.Taylor@Sun.COM * the "hermon_iommu_bypass" configuration variable), to always allocating 2599517SBill.Taylor@Sun.COM * a new dma handle, and to using the virtual address passed in (i.e. not 2609517SBill.Taylor@Sun.COM * "zero-based"). 2619517SBill.Taylor@Sun.COM */ 2629517SBill.Taylor@Sun.COM typedef struct hermon_mr_options_s { 2639517SBill.Taylor@Sun.COM ddi_dma_handle_t mro_bind_dmahdl; 2649517SBill.Taylor@Sun.COM uint_t mro_bind_type; 2659517SBill.Taylor@Sun.COM uint_t mro_bind_override_addr; 2669517SBill.Taylor@Sun.COM } hermon_mr_options_t; 2679517SBill.Taylor@Sun.COM #define HERMON_BINDMEM_NORMAL 1 2689517SBill.Taylor@Sun.COM #define HERMON_BINDMEM_BYPASS 0 2699517SBill.Taylor@Sun.COM 2709517SBill.Taylor@Sun.COM #define HERMON_NO_MPT_OWNERSHIP 0 /* for cMPTs */ 2719517SBill.Taylor@Sun.COM #define HERMON_PASS_MPT_OWNERSHIP 1 2729517SBill.Taylor@Sun.COM 2739517SBill.Taylor@Sun.COM /* 2749517SBill.Taylor@Sun.COM * Memory Allocation/Deallocation 2759517SBill.Taylor@Sun.COM * 2769517SBill.Taylor@Sun.COM * Although this is not strictly related to "memory regions", this is 2779517SBill.Taylor@Sun.COM * the most logical place to define the struct used for the memory 2789517SBill.Taylor@Sun.COM * allocation/deallocation CI entry points. 2799517SBill.Taylor@Sun.COM * 2809517SBill.Taylor@Sun.COM * ibc_mem_alloc_s structure is used to store DMA handles for 2819517SBill.Taylor@Sun.COM * for these allocations. 2829517SBill.Taylor@Sun.COM */ 2839517SBill.Taylor@Sun.COM struct ibc_mem_alloc_s { 2849517SBill.Taylor@Sun.COM ddi_dma_handle_t ibc_dma_hdl; 2859517SBill.Taylor@Sun.COM ddi_acc_handle_t ibc_acc_hdl; 2869517SBill.Taylor@Sun.COM }; 2879517SBill.Taylor@Sun.COM _NOTE(SCHEME_PROTECTS_DATA("safe sharing", 2889517SBill.Taylor@Sun.COM ibc_mem_alloc_s::ibc_dma_hdl 2899517SBill.Taylor@Sun.COM ibc_mem_alloc_s::ibc_acc_hdl)) 2909517SBill.Taylor@Sun.COM 291*12965SWilliam.Taylor@Oracle.COM int hermon_dma_mr_register(hermon_state_t *state, hermon_pdhdl_t pdhdl, 292*12965SWilliam.Taylor@Oracle.COM ibt_dmr_attr_t *attr_p, hermon_mrhdl_t *mrhdl); 2939517SBill.Taylor@Sun.COM int hermon_mr_register(hermon_state_t *state, hermon_pdhdl_t pdhdl, 2949517SBill.Taylor@Sun.COM ibt_mr_attr_t *attr_p, hermon_mrhdl_t *mrhdl, hermon_mr_options_t *op, 2959517SBill.Taylor@Sun.COM hermon_mpt_rsrc_type_t mpt_type); 2969517SBill.Taylor@Sun.COM int hermon_mr_register_buf(hermon_state_t *state, hermon_pdhdl_t pdhdl, 2979517SBill.Taylor@Sun.COM ibt_smr_attr_t *attrp, struct buf *buf, hermon_mrhdl_t *mrhdl, 2989517SBill.Taylor@Sun.COM hermon_mr_options_t *op, hermon_mpt_rsrc_type_t mpt_type); 2999517SBill.Taylor@Sun.COM int hermon_mr_mtt_bind(hermon_state_t *state, hermon_bind_info_t *bind, 3009517SBill.Taylor@Sun.COM ddi_dma_handle_t bind_dmahdl, hermon_rsrc_t **mtt, uint_t *mtt_pgsz_bits, 3019517SBill.Taylor@Sun.COM uint_t is_buffer); 3029517SBill.Taylor@Sun.COM int hermon_mr_mtt_unbind(hermon_state_t *state, hermon_bind_info_t *bind, 3039517SBill.Taylor@Sun.COM hermon_rsrc_t *mtt); 3049517SBill.Taylor@Sun.COM int hermon_mr_register_shared(hermon_state_t *state, hermon_mrhdl_t mrhdl, 3059517SBill.Taylor@Sun.COM hermon_pdhdl_t pdhdl, ibt_smr_attr_t *attr_p, hermon_mrhdl_t *mrhdl_new); 3069517SBill.Taylor@Sun.COM int hermon_mr_deregister(hermon_state_t *state, hermon_mrhdl_t *mrhdl, 3079517SBill.Taylor@Sun.COM uint_t level, uint_t sleep); 3089517SBill.Taylor@Sun.COM int hermon_mr_query(hermon_state_t *state, hermon_mrhdl_t mrhdl, 3099517SBill.Taylor@Sun.COM ibt_mr_query_attr_t *attr); 3109517SBill.Taylor@Sun.COM int hermon_mr_reregister(hermon_state_t *state, hermon_mrhdl_t mrhdl, 3119517SBill.Taylor@Sun.COM hermon_pdhdl_t pdhdl, ibt_mr_attr_t *attr_p, hermon_mrhdl_t *mrhdl_new, 3129517SBill.Taylor@Sun.COM hermon_mr_options_t *op); 3139517SBill.Taylor@Sun.COM int hermon_mr_reregister_buf(hermon_state_t *state, hermon_mrhdl_t mr, 3149517SBill.Taylor@Sun.COM hermon_pdhdl_t pd, ibt_smr_attr_t *mr_attr, struct buf *buf, 3159517SBill.Taylor@Sun.COM hermon_mrhdl_t *mrhdl_new, hermon_mr_options_t *op); 3169517SBill.Taylor@Sun.COM int hermon_mr_sync(hermon_state_t *state, ibt_mr_sync_t *mr_segs, 3179517SBill.Taylor@Sun.COM size_t num_segs); 3189517SBill.Taylor@Sun.COM int hermon_mw_alloc(hermon_state_t *state, hermon_pdhdl_t pdhdl, 3199517SBill.Taylor@Sun.COM ibt_mw_flags_t flags, hermon_mwhdl_t *mwhdl); 3209517SBill.Taylor@Sun.COM int hermon_mw_free(hermon_state_t *state, hermon_mwhdl_t *mwhdl, uint_t sleep); 3219517SBill.Taylor@Sun.COM uint32_t hermon_mr_keycalc(uint32_t indx); 3229517SBill.Taylor@Sun.COM uint32_t hermon_mr_key_swap(uint32_t indx); 3239517SBill.Taylor@Sun.COM uint32_t hermon_index_to_mkey(uint32_t indx); 3249517SBill.Taylor@Sun.COM int hermon_mr_alloc_fmr(hermon_state_t *state, hermon_pdhdl_t pd, 3259517SBill.Taylor@Sun.COM hermon_fmrhdl_t fmr_pool, hermon_mrhdl_t *mrhdl); 3269517SBill.Taylor@Sun.COM int hermon_mr_dealloc_fmr(hermon_state_t *state, hermon_mrhdl_t *mrhdl); 3279517SBill.Taylor@Sun.COM int hermon_mr_register_physical_fmr(hermon_state_t *state, 3289517SBill.Taylor@Sun.COM ibt_pmr_attr_t *mem_pattr_p, hermon_mrhdl_t mr, ibt_pmr_desc_t *mem_desc_p); 329*12965SWilliam.Taylor@Oracle.COM int hermon_mr_alloc_lkey(hermon_state_t *state, hermon_pdhdl_t pd, 330*12965SWilliam.Taylor@Oracle.COM ibt_lkey_flags_t flags, uint_t sz, hermon_mrhdl_t *mr); 331*12965SWilliam.Taylor@Oracle.COM int hermon_mr_fexch_mpt_init(hermon_state_t *state, hermon_pdhdl_t pd, 332*12965SWilliam.Taylor@Oracle.COM uint32_t mpt_indx, uint_t nummtt, uint64_t mtt_addr, uint_t sleep); 333*12965SWilliam.Taylor@Oracle.COM int hermon_mr_fexch_mpt_fini(hermon_state_t *state, hermon_pdhdl_t pd, 334*12965SWilliam.Taylor@Oracle.COM uint32_t mpt_indx, uint_t sleep); 3359517SBill.Taylor@Sun.COM 3369517SBill.Taylor@Sun.COM 3379517SBill.Taylor@Sun.COM #ifdef __cplusplus 3389517SBill.Taylor@Sun.COM } 3399517SBill.Taylor@Sun.COM #endif 3409517SBill.Taylor@Sun.COM 3419517SBill.Taylor@Sun.COM #endif /* _SYS_IB_ADAPTERS_HERMON_MR_H */ 342