Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | |
| 3 | Intel(R) Gigabit Ethernet Linux driver |
Carolyn Wyborny | 74cfb2e | 2014-02-25 17:58:57 -0800 | [diff] [blame] | 4 | Copyright(c) 2007-2014 Intel Corporation. |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 5 | |
| 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | under the terms and conditions of the GNU General Public License, |
| 8 | version 2, as published by the Free Software Foundation. |
| 9 | |
| 10 | This program is distributed in the hope it will be useful, but WITHOUT |
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 13 | more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License along with |
Carolyn Wyborny | 74cfb2e | 2014-02-25 17:58:57 -0800 | [diff] [blame] | 16 | this program; if not, see <http://www.gnu.org/licenses/>. |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 17 | |
| 18 | The full GNU General Public License is included in this distribution in |
| 19 | the file called "COPYING". |
| 20 | |
| 21 | Contact Information: |
| 22 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
| 23 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 24 | |
| 25 | *******************************************************************************/ |
| 26 | |
| 27 | #include "e1000_mbx.h" |
| 28 | |
| 29 | /** |
| 30 | * igb_read_mbx - Reads a message from the mailbox |
| 31 | * @hw: pointer to the HW structure |
| 32 | * @msg: The message buffer |
| 33 | * @size: Length of buffer |
| 34 | * @mbx_id: id of mailbox to read |
| 35 | * |
Joe Perches | bfb9035 | 2011-08-17 06:58:04 -0700 | [diff] [blame] | 36 | * returns SUCCESS if it successfully read message from buffer |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 37 | **/ |
| 38 | s32 igb_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) |
| 39 | { |
| 40 | struct e1000_mbx_info *mbx = &hw->mbx; |
| 41 | s32 ret_val = -E1000_ERR_MBX; |
| 42 | |
| 43 | /* limit read to size of mailbox */ |
| 44 | if (size > mbx->size) |
| 45 | size = mbx->size; |
| 46 | |
| 47 | if (mbx->ops.read) |
| 48 | ret_val = mbx->ops.read(hw, msg, size, mbx_id); |
| 49 | |
| 50 | return ret_val; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * igb_write_mbx - Write a message to the mailbox |
| 55 | * @hw: pointer to the HW structure |
| 56 | * @msg: The message buffer |
| 57 | * @size: Length of buffer |
| 58 | * @mbx_id: id of mailbox to write |
| 59 | * |
| 60 | * returns SUCCESS if it successfully copied message into the buffer |
| 61 | **/ |
| 62 | s32 igb_write_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) |
| 63 | { |
| 64 | struct e1000_mbx_info *mbx = &hw->mbx; |
| 65 | s32 ret_val = 0; |
| 66 | |
| 67 | if (size > mbx->size) |
| 68 | ret_val = -E1000_ERR_MBX; |
| 69 | |
| 70 | else if (mbx->ops.write) |
| 71 | ret_val = mbx->ops.write(hw, msg, size, mbx_id); |
| 72 | |
| 73 | return ret_val; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * igb_check_for_msg - checks to see if someone sent us mail |
| 78 | * @hw: pointer to the HW structure |
| 79 | * @mbx_id: id of mailbox to check |
| 80 | * |
| 81 | * returns SUCCESS if the Status bit was found or else ERR_MBX |
| 82 | **/ |
| 83 | s32 igb_check_for_msg(struct e1000_hw *hw, u16 mbx_id) |
| 84 | { |
| 85 | struct e1000_mbx_info *mbx = &hw->mbx; |
| 86 | s32 ret_val = -E1000_ERR_MBX; |
| 87 | |
| 88 | if (mbx->ops.check_for_msg) |
| 89 | ret_val = mbx->ops.check_for_msg(hw, mbx_id); |
| 90 | |
| 91 | return ret_val; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * igb_check_for_ack - checks to see if someone sent us ACK |
| 96 | * @hw: pointer to the HW structure |
| 97 | * @mbx_id: id of mailbox to check |
| 98 | * |
| 99 | * returns SUCCESS if the Status bit was found or else ERR_MBX |
| 100 | **/ |
| 101 | s32 igb_check_for_ack(struct e1000_hw *hw, u16 mbx_id) |
| 102 | { |
| 103 | struct e1000_mbx_info *mbx = &hw->mbx; |
| 104 | s32 ret_val = -E1000_ERR_MBX; |
| 105 | |
| 106 | if (mbx->ops.check_for_ack) |
| 107 | ret_val = mbx->ops.check_for_ack(hw, mbx_id); |
| 108 | |
| 109 | return ret_val; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * igb_check_for_rst - checks to see if other side has reset |
| 114 | * @hw: pointer to the HW structure |
| 115 | * @mbx_id: id of mailbox to check |
| 116 | * |
| 117 | * returns SUCCESS if the Status bit was found or else ERR_MBX |
| 118 | **/ |
| 119 | s32 igb_check_for_rst(struct e1000_hw *hw, u16 mbx_id) |
| 120 | { |
| 121 | struct e1000_mbx_info *mbx = &hw->mbx; |
| 122 | s32 ret_val = -E1000_ERR_MBX; |
| 123 | |
| 124 | if (mbx->ops.check_for_rst) |
| 125 | ret_val = mbx->ops.check_for_rst(hw, mbx_id); |
| 126 | |
| 127 | return ret_val; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * igb_poll_for_msg - Wait for message notification |
| 132 | * @hw: pointer to the HW structure |
| 133 | * @mbx_id: id of mailbox to write |
| 134 | * |
| 135 | * returns SUCCESS if it successfully received a message notification |
| 136 | **/ |
| 137 | static s32 igb_poll_for_msg(struct e1000_hw *hw, u16 mbx_id) |
| 138 | { |
| 139 | struct e1000_mbx_info *mbx = &hw->mbx; |
| 140 | int countdown = mbx->timeout; |
| 141 | |
Alexander Duyck | 3935358 | 2009-04-27 22:34:54 +0000 | [diff] [blame] | 142 | if (!countdown || !mbx->ops.check_for_msg) |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 143 | goto out; |
| 144 | |
Alexander Duyck | 3272686 | 2009-10-05 06:34:05 +0000 | [diff] [blame] | 145 | while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) { |
Alexander Duyck | 3935358 | 2009-04-27 22:34:54 +0000 | [diff] [blame] | 146 | countdown--; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 147 | if (!countdown) |
| 148 | break; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 149 | udelay(mbx->usec_delay); |
| 150 | } |
Alexander Duyck | 3272686 | 2009-10-05 06:34:05 +0000 | [diff] [blame] | 151 | |
| 152 | /* if we failed, all future posted messages fail until reset */ |
| 153 | if (!countdown) |
| 154 | mbx->timeout = 0; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 155 | out: |
| 156 | return countdown ? 0 : -E1000_ERR_MBX; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * igb_poll_for_ack - Wait for message acknowledgement |
| 161 | * @hw: pointer to the HW structure |
| 162 | * @mbx_id: id of mailbox to write |
| 163 | * |
| 164 | * returns SUCCESS if it successfully received a message acknowledgement |
| 165 | **/ |
| 166 | static s32 igb_poll_for_ack(struct e1000_hw *hw, u16 mbx_id) |
| 167 | { |
| 168 | struct e1000_mbx_info *mbx = &hw->mbx; |
| 169 | int countdown = mbx->timeout; |
| 170 | |
Alexander Duyck | 3935358 | 2009-04-27 22:34:54 +0000 | [diff] [blame] | 171 | if (!countdown || !mbx->ops.check_for_ack) |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 172 | goto out; |
| 173 | |
Alexander Duyck | 3272686 | 2009-10-05 06:34:05 +0000 | [diff] [blame] | 174 | while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) { |
Alexander Duyck | 3935358 | 2009-04-27 22:34:54 +0000 | [diff] [blame] | 175 | countdown--; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 176 | if (!countdown) |
| 177 | break; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 178 | udelay(mbx->usec_delay); |
| 179 | } |
Alexander Duyck | 3272686 | 2009-10-05 06:34:05 +0000 | [diff] [blame] | 180 | |
| 181 | /* if we failed, all future posted messages fail until reset */ |
| 182 | if (!countdown) |
| 183 | mbx->timeout = 0; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 184 | out: |
| 185 | return countdown ? 0 : -E1000_ERR_MBX; |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * igb_read_posted_mbx - Wait for message notification and receive message |
| 190 | * @hw: pointer to the HW structure |
| 191 | * @msg: The message buffer |
| 192 | * @size: Length of buffer |
| 193 | * @mbx_id: id of mailbox to write |
| 194 | * |
| 195 | * returns SUCCESS if it successfully received a message notification and |
| 196 | * copied it into the receive buffer. |
| 197 | **/ |
Jeff Kirsher | b980ac1 | 2013-02-23 07:29:56 +0000 | [diff] [blame] | 198 | static s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, |
| 199 | u16 mbx_id) |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 200 | { |
| 201 | struct e1000_mbx_info *mbx = &hw->mbx; |
| 202 | s32 ret_val = -E1000_ERR_MBX; |
| 203 | |
| 204 | if (!mbx->ops.read) |
| 205 | goto out; |
| 206 | |
| 207 | ret_val = igb_poll_for_msg(hw, mbx_id); |
| 208 | |
| 209 | if (!ret_val) |
| 210 | ret_val = mbx->ops.read(hw, msg, size, mbx_id); |
| 211 | out: |
| 212 | return ret_val; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * igb_write_posted_mbx - Write a message to the mailbox, wait for ack |
| 217 | * @hw: pointer to the HW structure |
| 218 | * @msg: The message buffer |
| 219 | * @size: Length of buffer |
| 220 | * @mbx_id: id of mailbox to write |
| 221 | * |
| 222 | * returns SUCCESS if it successfully copied message into the buffer and |
| 223 | * received an ack to that message within delay * timeout period |
| 224 | **/ |
Jeff Kirsher | b980ac1 | 2013-02-23 07:29:56 +0000 | [diff] [blame] | 225 | static s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, |
| 226 | u16 mbx_id) |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 227 | { |
| 228 | struct e1000_mbx_info *mbx = &hw->mbx; |
Alexander Duyck | 3272686 | 2009-10-05 06:34:05 +0000 | [diff] [blame] | 229 | s32 ret_val = -E1000_ERR_MBX; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 230 | |
Alexander Duyck | 3272686 | 2009-10-05 06:34:05 +0000 | [diff] [blame] | 231 | /* exit if either we can't write or there isn't a defined timeout */ |
| 232 | if (!mbx->ops.write || !mbx->timeout) |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 233 | goto out; |
| 234 | |
Alexander Duyck | 3272686 | 2009-10-05 06:34:05 +0000 | [diff] [blame] | 235 | /* send msg */ |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 236 | ret_val = mbx->ops.write(hw, msg, size, mbx_id); |
| 237 | |
| 238 | /* if msg sent wait until we receive an ack */ |
| 239 | if (!ret_val) |
| 240 | ret_val = igb_poll_for_ack(hw, mbx_id); |
| 241 | out: |
| 242 | return ret_val; |
| 243 | } |
| 244 | |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 245 | static s32 igb_check_for_bit_pf(struct e1000_hw *hw, u32 mask) |
| 246 | { |
| 247 | u32 mbvficr = rd32(E1000_MBVFICR); |
| 248 | s32 ret_val = -E1000_ERR_MBX; |
| 249 | |
| 250 | if (mbvficr & mask) { |
| 251 | ret_val = 0; |
| 252 | wr32(E1000_MBVFICR, mask); |
| 253 | } |
| 254 | |
| 255 | return ret_val; |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * igb_check_for_msg_pf - checks to see if the VF has sent mail |
| 260 | * @hw: pointer to the HW structure |
| 261 | * @vf_number: the VF index |
| 262 | * |
| 263 | * returns SUCCESS if the VF has set the Status bit or else ERR_MBX |
| 264 | **/ |
| 265 | static s32 igb_check_for_msg_pf(struct e1000_hw *hw, u16 vf_number) |
| 266 | { |
| 267 | s32 ret_val = -E1000_ERR_MBX; |
| 268 | |
| 269 | if (!igb_check_for_bit_pf(hw, E1000_MBVFICR_VFREQ_VF1 << vf_number)) { |
| 270 | ret_val = 0; |
| 271 | hw->mbx.stats.reqs++; |
| 272 | } |
| 273 | |
| 274 | return ret_val; |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * igb_check_for_ack_pf - checks to see if the VF has ACKed |
| 279 | * @hw: pointer to the HW structure |
| 280 | * @vf_number: the VF index |
| 281 | * |
| 282 | * returns SUCCESS if the VF has set the Status bit or else ERR_MBX |
| 283 | **/ |
| 284 | static s32 igb_check_for_ack_pf(struct e1000_hw *hw, u16 vf_number) |
| 285 | { |
| 286 | s32 ret_val = -E1000_ERR_MBX; |
| 287 | |
| 288 | if (!igb_check_for_bit_pf(hw, E1000_MBVFICR_VFACK_VF1 << vf_number)) { |
| 289 | ret_val = 0; |
| 290 | hw->mbx.stats.acks++; |
| 291 | } |
| 292 | |
| 293 | return ret_val; |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * igb_check_for_rst_pf - checks to see if the VF has reset |
| 298 | * @hw: pointer to the HW structure |
| 299 | * @vf_number: the VF index |
| 300 | * |
| 301 | * returns SUCCESS if the VF has set the Status bit or else ERR_MBX |
| 302 | **/ |
| 303 | static s32 igb_check_for_rst_pf(struct e1000_hw *hw, u16 vf_number) |
| 304 | { |
| 305 | u32 vflre = rd32(E1000_VFLRE); |
| 306 | s32 ret_val = -E1000_ERR_MBX; |
| 307 | |
| 308 | if (vflre & (1 << vf_number)) { |
| 309 | ret_val = 0; |
| 310 | wr32(E1000_VFLRE, (1 << vf_number)); |
| 311 | hw->mbx.stats.rsts++; |
| 312 | } |
| 313 | |
| 314 | return ret_val; |
| 315 | } |
| 316 | |
| 317 | /** |
Alexander Duyck | 0acb6fd | 2009-10-05 06:33:46 +0000 | [diff] [blame] | 318 | * igb_obtain_mbx_lock_pf - obtain mailbox lock |
| 319 | * @hw: pointer to the HW structure |
| 320 | * @vf_number: the VF index |
| 321 | * |
| 322 | * return SUCCESS if we obtained the mailbox lock |
| 323 | **/ |
| 324 | static s32 igb_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number) |
| 325 | { |
| 326 | s32 ret_val = -E1000_ERR_MBX; |
| 327 | u32 p2v_mailbox; |
| 328 | |
Alexander Duyck | 0acb6fd | 2009-10-05 06:33:46 +0000 | [diff] [blame] | 329 | /* Take ownership of the buffer */ |
| 330 | wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU); |
| 331 | |
| 332 | /* reserve mailbox for vf use */ |
| 333 | p2v_mailbox = rd32(E1000_P2VMAILBOX(vf_number)); |
| 334 | if (p2v_mailbox & E1000_P2VMAILBOX_PFU) |
| 335 | ret_val = 0; |
| 336 | |
| 337 | return ret_val; |
| 338 | } |
| 339 | |
| 340 | /** |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 341 | * igb_write_mbx_pf - Places a message in the mailbox |
| 342 | * @hw: pointer to the HW structure |
| 343 | * @msg: The message buffer |
| 344 | * @size: Length of buffer |
| 345 | * @vf_number: the VF index |
| 346 | * |
| 347 | * returns SUCCESS if it successfully copied message into the buffer |
| 348 | **/ |
| 349 | static s32 igb_write_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size, |
Jeff Kirsher | b980ac1 | 2013-02-23 07:29:56 +0000 | [diff] [blame] | 350 | u16 vf_number) |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 351 | { |
Alexander Duyck | 0acb6fd | 2009-10-05 06:33:46 +0000 | [diff] [blame] | 352 | s32 ret_val; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 353 | u16 i; |
| 354 | |
Alexander Duyck | 0acb6fd | 2009-10-05 06:33:46 +0000 | [diff] [blame] | 355 | /* lock the mailbox to prevent pf/vf race condition */ |
| 356 | ret_val = igb_obtain_mbx_lock_pf(hw, vf_number); |
| 357 | if (ret_val) |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 358 | goto out_no_write; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 359 | |
Alexander Duyck | 0acb6fd | 2009-10-05 06:33:46 +0000 | [diff] [blame] | 360 | /* flush msg and acks as we are overwriting the message buffer */ |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 361 | igb_check_for_msg_pf(hw, vf_number); |
Alexander Duyck | 0acb6fd | 2009-10-05 06:33:46 +0000 | [diff] [blame] | 362 | igb_check_for_ack_pf(hw, vf_number); |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 363 | |
| 364 | /* copy the caller specified message to the mailbox memory buffer */ |
| 365 | for (i = 0; i < size; i++) |
| 366 | array_wr32(E1000_VMBMEM(vf_number), i, msg[i]); |
| 367 | |
| 368 | /* Interrupt VF to tell it a message has been sent and release buffer*/ |
| 369 | wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_STS); |
| 370 | |
| 371 | /* update stats */ |
| 372 | hw->mbx.stats.msgs_tx++; |
| 373 | |
| 374 | out_no_write: |
| 375 | return ret_val; |
| 376 | |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * igb_read_mbx_pf - Read a message from the mailbox |
| 381 | * @hw: pointer to the HW structure |
| 382 | * @msg: The message buffer |
| 383 | * @size: Length of buffer |
| 384 | * @vf_number: the VF index |
| 385 | * |
| 386 | * This function copies a message from the mailbox buffer to the caller's |
| 387 | * memory buffer. The presumption is that the caller knows that there was |
| 388 | * a message due to a VF request so no polling for message is needed. |
| 389 | **/ |
| 390 | static s32 igb_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size, |
Jeff Kirsher | b980ac1 | 2013-02-23 07:29:56 +0000 | [diff] [blame] | 391 | u16 vf_number) |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 392 | { |
Alexander Duyck | 0acb6fd | 2009-10-05 06:33:46 +0000 | [diff] [blame] | 393 | s32 ret_val; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 394 | u16 i; |
| 395 | |
Alexander Duyck | 0acb6fd | 2009-10-05 06:33:46 +0000 | [diff] [blame] | 396 | /* lock the mailbox to prevent pf/vf race condition */ |
| 397 | ret_val = igb_obtain_mbx_lock_pf(hw, vf_number); |
| 398 | if (ret_val) |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 399 | goto out_no_read; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 400 | |
| 401 | /* copy the message to the mailbox memory buffer */ |
| 402 | for (i = 0; i < size; i++) |
| 403 | msg[i] = array_rd32(E1000_VMBMEM(vf_number), i); |
| 404 | |
| 405 | /* Acknowledge the message and release buffer */ |
| 406 | wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_ACK); |
| 407 | |
| 408 | /* update stats */ |
| 409 | hw->mbx.stats.msgs_rx++; |
| 410 | |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 411 | out_no_read: |
| 412 | return ret_val; |
| 413 | } |
| 414 | |
| 415 | /** |
| 416 | * e1000_init_mbx_params_pf - set initial values for pf mailbox |
| 417 | * @hw: pointer to the HW structure |
| 418 | * |
| 419 | * Initializes the hw->mbx struct to correct values for pf mailbox |
| 420 | */ |
| 421 | s32 igb_init_mbx_params_pf(struct e1000_hw *hw) |
| 422 | { |
| 423 | struct e1000_mbx_info *mbx = &hw->mbx; |
| 424 | |
Carolyn Wyborny | 6b78bb1 | 2011-01-20 06:40:45 +0000 | [diff] [blame] | 425 | mbx->timeout = 0; |
| 426 | mbx->usec_delay = 0; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 427 | |
Carolyn Wyborny | 6b78bb1 | 2011-01-20 06:40:45 +0000 | [diff] [blame] | 428 | mbx->size = E1000_VFMAILBOX_SIZE; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 429 | |
Carolyn Wyborny | 6b78bb1 | 2011-01-20 06:40:45 +0000 | [diff] [blame] | 430 | mbx->ops.read = igb_read_mbx_pf; |
| 431 | mbx->ops.write = igb_write_mbx_pf; |
| 432 | mbx->ops.read_posted = igb_read_posted_mbx; |
| 433 | mbx->ops.write_posted = igb_write_posted_mbx; |
| 434 | mbx->ops.check_for_msg = igb_check_for_msg_pf; |
| 435 | mbx->ops.check_for_ack = igb_check_for_ack_pf; |
| 436 | mbx->ops.check_for_rst = igb_check_for_rst_pf; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 437 | |
Carolyn Wyborny | 6b78bb1 | 2011-01-20 06:40:45 +0000 | [diff] [blame] | 438 | mbx->stats.msgs_tx = 0; |
| 439 | mbx->stats.msgs_rx = 0; |
| 440 | mbx->stats.reqs = 0; |
| 441 | mbx->stats.acks = 0; |
| 442 | mbx->stats.rsts = 0; |
Alexander Duyck | 4ae196d | 2009-02-19 20:40:07 -0800 | [diff] [blame] | 443 | |
| 444 | return 0; |
| 445 | } |
| 446 | |