1 /*- 2 * Copyright(c) 2002-2011 Exar Corp. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification are permitted provided the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * 3. Neither the name of the Exar Corporation nor the names of its 16 * contributors may be used to endorse or promote products derived from 17 * this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 /*$FreeBSD: stable/9/sys/dev/vxge/vxgehal/vxgehal-doorbells.h 221167 2011-04-28 14:33:15Z gnn $*/ 32 33 #ifndef VXGE_HAL_DOOR_BELLS_H 34 #define VXGE_HAL_DOOR_BELLS_H 35 36 __EXTERN_BEGIN_DECLS 37 38 /* 39 * struct __hal_non_offload_db_wrapper_t - Non-offload Doorbell Wrapper 40 * @control_0: Bits 0 to 7 - Doorbell type. 41 * Bits 8 to 31 - Reserved. 42 * Bits 32 to 39 - The highest TxD in this TxDL. 43 * Bits 40 to 47 - Reserved. 44 * Bits 48 to 55 - Reserved. 45 * Bits 56 to 63 - No snoop flags. 46 * @txdl_ptr: The starting location of the TxDL in host memory. 47 * 48 * Created by the host and written to the adapter via PIO to a Kernel Doorbell 49 * FIFO. All non-offload doorbell wrapper fields must be written by the host as 50 * part of a doorbell write. Consumed by the adapter but is not written by the 51 * adapter. 52 */ 53 typedef __vxge_os_attr_cacheline_aligned struct __hal_non_offload_db_wrapper_t { 54 u64 control_0; 55 #define VXGE_HAL_NODBW_GET_TYPE(ctrl0) bVAL8(ctrl0, 0) 56 #define VXGE_HAL_NODBW_TYPE(val) vBIT(val, 0, 8) 57 #define VXGE_HAL_NODBW_TYPE_NODBW 0 58 59 #define VXGE_HAL_NODBW_GET_LAST_TXD_NUMBER(ctrl0) bVAL8(ctrl0, 32) 60 #define VXGE_HAL_NODBW_LAST_TXD_NUMBER(val) vBIT(val, 32, 8) 61 62 #define VXGE_HAL_NODBW_GET_NO_SNOOP(ctrl0) bVAL8(ctrl0, 56) 63 #define VXGE_HAL_NODBW_LIST_NO_SNOOP(val) vBIT(val, 56, 8) 64 #define VXGE_HAL_NODBW_LIST_NO_SNOOP_TXD_READ_TXD0_WRITE 0x2 65 #define VXGE_HAL_NODBW_LIST_NO_SNOOP_TX_FRAME_DATA_READ 0x1 66 67 u64 txdl_ptr; 68 } __hal_non_offload_db_wrapper_t; 69 70 /* 71 * struct __hal_offload_db_wrapper_t - Tx-Offload Doorbell Wrapper 72 * @control_0: Bits 0 to 7 - Doorbell type. 73 * Bits 8 to 31 - Identifies the session to which this Tx 74 * offload doorbell applies. 75 * Bits 32 to 40 - Identifies the incarnation of this Session 76 * Number. The adapter assigns a Session Instance 77 * Number of 0 to a session when that Session Number 78 * is first used. Each subsequent assignment of that 79 * Session Number from the free pool causes this 80 * number to be incremented, with wrap eventually 81 * occurring from 255 back to 0. 82 * Bits 40 to 63 - Identifies the end of the TOWI list for 83 * this session to the adapter. 84 * @control_1: Bits 0 to 7 - Identifies what is included in this doorbell 85 * Bits 8 to 15 - The number of Immediate data bytes included in 86 * this doorbell. 87 * Bits 16 to 63 - Reserved. 88 * 89 * Created by the host and written to the adapter via PIO to a Kernel Doorbell 90 * FIFO. All Tx Offload doorbell wrapper fields must be written by the host as 91 * part of a doorbell write. Consumed by the adapter but is never written by the 92 * adapter. 93 */ 94 typedef __vxge_os_attr_cacheline_aligned struct __hal_offload_db_wrapper_t { 95 u64 control_0; 96 #define VXGE_HAL_ODBW_GET_TYPE(ctrl0) bVAL8(ctrl0, 0) 97 #define VXGE_HAL_ODBW_TYPE(val) vBIT(val, 0, 8) 98 #define VXGE_HAL_ODBW_TYPE_ODBW 1 99 100 #define VXGE_HAL_ODBW_GET_SESSION_NUMBER(ctrl0) bVAL24(ctrl0, 8) 101 #define VXGE_HAL_ODBW_SESSION_NUMBER(val) vBIT(val, 8, 24) 102 103 #define VXGE_HAL_ODBW_GET_SESSION_INST_NUMBER(ctrl0) bVAL8(ctrl0, 32) 104 #define VXGE_HAL_ODBW_SESSION_INST_NUMBER(val) vBIT(val, 32, 8) 105 106 #define VXGE_HAL_ODBW_GET_HIGH_TOWI_NUMBER(ctrl0) bVAL24(ctrl0, 40) 107 #define VXGE_HAL_ODBW_HIGH_TOWI_NUMBER(val) vBIT(val, 40, 24) 108 109 u64 control_1; 110 #define VXGE_HAL_ODBW_GET_ENTRY_TYPE(ctrl1) bVAL8(ctrl1, 0) 111 #define VXGE_HAL_ODBW_ENTRY_TYPE(val) vBIT(val, 0, 8) 112 #define VXGE_HAL_ODBW_ENTRY_TYPE_WRAPPER_ONLY 0x0 113 #define VXGE_HAL_ODBW_ENTRY_TYPE_WRAPPER_TOWI 0x1 114 #define VXGE_HAL_ODBW_ENTRY_TYPE_WRAPPER_TOWI_DATA 0x2 115 116 #define VXGE_HAL_ODBW_GET_IMMEDIATE_BYTE_COUNT(ctrl1) bVAL8(ctrl1, 8) 117 #define VXGE_HAL_ODBW_IMMEDIATE_BYTE_COUNT(val) vBIT(val, 8, 8) 118 119 } __hal_offload_db_wrapper_t; 120 121 /* 122 * struct __hal_offload_atomic_db_wrapper_t - Atomic Tx-Offload Doorbell 123 * Wrapper 124 * @control_0: Bits 0 to 7 - Doorbell type. 125 * Bits 8 to 31 - Identifies the session to which this Tx 126 * offload doorbell applies. 127 * Bits 32 to 40 - Identifies the incarnation of this Session 128 * Number. The adapter assigns a Session Instance 129 * Number of 0 to a session when that Session Number 130 * is first used. Each subsequent assignment of that 131 * Session Number from the free pool causes this 132 * number to be incremented, with wrap eventually 133 * occurring from 255 back to 0. 134 * Bits 40 to 63 - Identifies the end of the TOWI list for 135 * this session to the adapter. 136 * 137 * Created by the host and written to the adapter via PIO to a Kernel Doorbell 138 * FIFO. All Tx Offload doorbell wrapper fields must be written by the host as 139 * part of a doorbell write. Consumed by the adapter but is never written by the 140 * adapter. 141 */ 142 typedef __vxge_os_attr_cacheline_aligned 143 struct __hal_offload_atomic_db_wrapper_t { 144 u64 control_0; 145 #define VXGE_HAL_ODBW_GET_TYPE(ctrl0) bVAL8(ctrl0, 0) 146 #define VXGE_HAL_ODBW_TYPE(val) vBIT(val, 0, 8) 147 #define VXGE_HAL_ODBW_TYPE_ATOMIC 2 148 149 #define VXGE_HAL_ODBW_GET_SESSION_NUMBER(ctrl0) bVAL24(ctrl0, 8) 150 #define VXGE_HAL_ODBW_SESSION_NUMBER(val) vBIT(val, 8, 24) 151 152 #define VXGE_HAL_ODBW_GET_SESSION_INST_NUMBER(ctrl0) bVAL8(ctrl0, 32) 153 #define VXGE_HAL_ODBW_SESSION_INST_NUMBER(val) vBIT(val, 32, 8) 154 155 #define VXGE_HAL_ODBW_GET_HIGH_TOWI_NUMBER(ctrl0) bVAL24(ctrl0, 40) 156 #define VXGE_HAL_ODBW_HIGH_TOWI_NUMBER(val) vBIT(val, 40, 24) 157 158 } __hal_offload_atomic_db_wrapper_t; 159 160 161 162 /* 163 * struct __hal_messaging_db_wrapper_t - Messaging Doorbell Wrapper 164 * @control_0: Bits 0 to 7 - Doorbell type. 165 * Bits 8 to 31 - Reserved. 166 * Bits 32 to 63 - The number of new message bytes made available 167 * by this doorbell entry. 168 * @control_1: Bits 0 to 7 - Reserved. 169 * Bits 8 to 15 - The number of Immediate messaging bytes included 170 * in this doorbell. 171 * Bits 16 to 63 - Reserved. 172 * 173 * Created by the host and written to the adapter via PIO to a Kernel Doorbell 174 * FIFO. All message doorbell wrapper fields must be written by the host as 175 * part of a doorbell write. Consumed by the adapter but not written by adapter. 176 */ 177 typedef __vxge_os_attr_cacheline_aligned struct __hal_messaging_db_wrapper_t { 178 u64 control_0; 179 #define VXGE_HAL_MDBW_GET_TYPE(ctrl0) bVAL8(ctrl0, 0) 180 #define VXGE_HAL_MDBW_TYPE(val) vBIT(val, 0, 8) 181 #define VXGE_HAL_MDBW_TYPE_MDBW 3 182 183 #define VXGE_HAL_MDBW_GET_MESSAGE_BYTE_COUNT(ctrl0) bVAL32(ctrl0, 32) 184 #define VXGE_HAL_MDBW_MESSAGE_BYTE_COUNT(val) vBIT(val, 32, 32) 185 186 u64 control_1; 187 #define VXGE_HAL_MDBW_GET_IMMEDIATE_BYTE_COUNT(ctrl1) bVAL8(ctrl1, 8) 188 #define VXGE_HAL_MDBW_IMMEDIATE_BYTE_COUNT(val) vBIT(val, 8, 8) 189 190 } __hal_messaging_db_wrapper_t; 191 192 193 void 194 __hal_non_offload_db_post(vxge_hal_vpath_h vpath_handle, 195 u64 txdl_ptr, 196 u32 num_txds, 197 u32 no_snoop); 198 199 void 200 __hal_rxd_db_post(vxge_hal_vpath_h vpath_handle, 201 u32 num_bytes); 202 203 vxge_hal_status_e 204 __hal_non_offload_db_reset(vxge_hal_vpath_h vpath_handle); 205 206 207 void 208 __hal_message_db_post(vxge_hal_vpath_h vpath_handle, 209 u32 num_msg_bytes, 210 u8 *immed_msg, 211 u32 immed_msg_len); 212 213 vxge_hal_status_e 214 __hal_message_db_reset(vxge_hal_vpath_h vpath_handle); 215 216 __EXTERN_END_DECLS 217 218 #endif /* VXGE_HAL_DOOR_BELLS_H */ 219