Lines Matching defs:hw
45 static s32 ixgbe_poll_for_msg(struct ixgbe_hw *hw, u16 mbx_id);
46 static s32 ixgbe_poll_for_ack(struct ixgbe_hw *hw, u16 mbx_id);
50 * @hw: pointer to the HW structure
57 s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
59 struct ixgbe_mbx_info *mbx = &hw->mbx;
72 return mbx->ops[mbx_id].read(hw, msg, size, mbx_id);
79 * @hw: pointer to the HW structure
86 s32 ixgbe_poll_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
88 struct ixgbe_mbx_info *mbx = &hw->mbx;
105 ret_val = ixgbe_poll_for_msg(hw, mbx_id);
108 return mbx->ops[mbx_id].read(hw, msg, size, mbx_id);
115 * @hw: pointer to the HW structure
123 s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
125 struct ixgbe_mbx_info *mbx = &hw->mbx;
143 ret_val = mbx->ops[mbx_id].write(hw, msg, size, mbx_id);
151 * @hw: pointer to the HW structure
156 s32 ixgbe_check_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
158 struct ixgbe_mbx_info *mbx = &hw->mbx;
164 ret_val = mbx->ops[mbx_id].check_for_msg(hw, mbx_id);
171 * @hw: pointer to the HW structure
176 s32 ixgbe_check_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
178 struct ixgbe_mbx_info *mbx = &hw->mbx;
184 ret_val = mbx->ops[mbx_id].check_for_ack(hw, mbx_id);
191 * @hw: pointer to the HW structure
196 s32 ixgbe_check_for_rst(struct ixgbe_hw *hw, u16 mbx_id)
198 struct ixgbe_mbx_info *mbx = &hw->mbx;
204 ret_val = mbx->ops[mbx_id].check_for_rst(hw, mbx_id);
211 * @hw: pointer to the HW structure
216 s32 ixgbe_clear_mbx(struct ixgbe_hw *hw, u16 mbx_id)
218 struct ixgbe_mbx_info *mbx = &hw->mbx;
224 ret_val = mbx->ops[mbx_id].clear(hw, mbx_id);
231 * @hw: pointer to the HW structure
236 static s32 ixgbe_poll_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
238 struct ixgbe_mbx_info *mbx = &hw->mbx;
246 while (countdown && mbx->ops[mbx_id].check_for_msg(hw, mbx_id)) {
264 * @hw: pointer to the HW structure
269 static s32 ixgbe_poll_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
271 struct ixgbe_mbx_info *mbx = &hw->mbx;
279 while (countdown && mbx->ops[mbx_id].check_for_ack(hw, mbx_id)) {
298 * @hw: pointer to the HW structure
303 static u32 ixgbe_read_mailbox_vf(struct ixgbe_hw *hw)
305 u32 vf_mailbox = IXGBE_READ_REG(hw, IXGBE_VFMAILBOX);
307 vf_mailbox |= hw->mbx.vf_mailbox;
308 hw->mbx.vf_mailbox |= vf_mailbox & IXGBE_VFMAILBOX_R2C_BITS;
313 static void ixgbe_clear_msg_vf(struct ixgbe_hw *hw)
315 u32 vf_mailbox = ixgbe_read_mailbox_vf(hw);
318 IXGBE_EVC_ADD(&hw->mbx.stats.reqs, 1);
319 hw->mbx.vf_mailbox &= ~IXGBE_VFMAILBOX_PFSTS;
323 static void ixgbe_clear_ack_vf(struct ixgbe_hw *hw)
325 u32 vf_mailbox = ixgbe_read_mailbox_vf(hw);
328 IXGBE_EVC_ADD(&hw->mbx.stats.acks, 1);
329 hw->mbx.vf_mailbox &= ~IXGBE_VFMAILBOX_PFACK;
333 static void ixgbe_clear_rst_vf(struct ixgbe_hw *hw)
335 u32 vf_mailbox = ixgbe_read_mailbox_vf(hw);
338 IXGBE_EVC_ADD(&hw->mbx.stats.rsts, 1);
339 hw->mbx.vf_mailbox &= ~(IXGBE_VFMAILBOX_RSTI |
346 * @hw: pointer to the HW structure
352 static s32 ixgbe_check_for_bit_vf(struct ixgbe_hw *hw, u32 mask)
354 u32 vf_mailbox = ixgbe_read_mailbox_vf(hw);
364 * @hw: pointer to the HW structure
369 static s32 ixgbe_check_for_msg_vf(struct ixgbe_hw *hw, u16 mbx_id)
374 if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_PFSTS)) {
375 IXGBE_EVC_ADD(&hw->mbx.stats.reqs, 1);
384 * @hw: pointer to the HW structure
389 static s32 ixgbe_check_for_ack_vf(struct ixgbe_hw *hw, u16 mbx_id)
394 if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_PFACK)) {
396 ixgbe_clear_ack_vf(hw);
397 IXGBE_EVC_ADD(&hw->mbx.stats.acks, 1);
406 * @hw: pointer to the HW structure
411 static s32 ixgbe_check_for_rst_vf(struct ixgbe_hw *hw, u16 mbx_id)
416 if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_RSTI |
419 ixgbe_clear_rst_vf(hw);
420 IXGBE_EVC_ADD(&hw->mbx.stats.rsts, 1);
429 * @hw: pointer to the HW structure
433 static s32 ixgbe_obtain_mbx_lock_vf(struct ixgbe_hw *hw)
435 struct ixgbe_mbx_info *mbx = &hw->mbx;
447 vf_mailbox = ixgbe_read_mailbox_vf(hw);
449 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, vf_mailbox);
452 if (ixgbe_read_mailbox_vf(hw) & IXGBE_VFMAILBOX_VFU) {
472 * @hw: pointer to the HW structure
475 static void ixgbe_release_mbx_lock_dummy(struct ixgbe_hw *hw, u16 mbx_id)
477 UNREFERENCED_2PARAMETER(hw, mbx_id);
484 * @hw: pointer to the HW structure
487 static void ixgbe_release_mbx_lock_vf(struct ixgbe_hw *hw, u16 mbx_id)
496 vf_mailbox = ixgbe_read_mailbox_vf(hw);
498 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, vf_mailbox);
503 * @hw: pointer to the HW structure
510 static s32 ixgbe_write_mbx_vf_legacy(struct ixgbe_hw *hw, u32 *msg, u16 size,
520 ret_val = ixgbe_obtain_mbx_lock_vf(hw);
525 ixgbe_check_for_msg_vf(hw, 0);
526 ixgbe_clear_msg_vf(hw);
527 ixgbe_check_for_ack_vf(hw, 0);
528 ixgbe_clear_ack_vf(hw);
532 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, msg[i]);
535 IXGBE_EVC_ADD(&hw->mbx.stats.msgs_tx, 1);
538 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_REQ);
545 * @hw: pointer to the HW structure
552 static s32 ixgbe_write_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
564 ret_val = ixgbe_obtain_mbx_lock_vf(hw);
569 ixgbe_clear_msg_vf(hw);
570 ixgbe_clear_ack_vf(hw);
574 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, msg[i]);
577 IXGBE_EVC_ADD(&hw->mbx.stats.msgs_tx, 1);
580 vf_mailbox = ixgbe_read_mailbox_vf(hw);
582 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, vf_mailbox);
585 ixgbe_poll_for_ack(hw, mbx_id);
588 hw->mbx.ops[mbx_id].release(hw, mbx_id);
595 * @hw: pointer to the HW structure
602 static s32 ixgbe_read_mbx_vf_legacy(struct ixgbe_hw *hw, u32 *msg, u16 size,
612 ret_val = ixgbe_obtain_mbx_lock_vf(hw);
618 msg[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_VFMBMEM, i);
621 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_ACK);
624 IXGBE_EVC_ADD(&hw->mbx.stats.msgs_rx, 1);
631 * @hw: pointer to the HW structure
638 static s32 ixgbe_read_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
649 ret_val = ixgbe_check_for_msg_vf(hw, 0);
653 ixgbe_clear_msg_vf(hw);
657 msg[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_VFMBMEM, i);
660 vf_mailbox = ixgbe_read_mailbox_vf(hw);
662 IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, vf_mailbox);
665 IXGBE_EVC_ADD(&hw->mbx.stats.msgs_rx, 1);
672 * @hw: pointer to the HW structure
674 * Initializes single set the hw->mbx struct to correct values for vf mailbox
677 void ixgbe_init_mbx_params_vf(struct ixgbe_hw *hw)
679 struct ixgbe_mbx_info *mbx = &hw->mbx;
704 * @hw: pointer to the HW structure
706 * Initializes the hw->mbx struct to correct values for vf mailbox
708 void ixgbe_upgrade_mbx_params_vf(struct ixgbe_hw *hw)
710 struct ixgbe_mbx_info *mbx = &hw->mbx;
727 static void ixgbe_clear_msg_pf(struct ixgbe_hw *hw, u16 vf_id)
733 pfmbicr = IXGBE_READ_REG(hw, IXGBE_PFMBICR(index));
736 IXGBE_EVC_ADD(&hw->mbx.stats.reqs, 1);
738 IXGBE_WRITE_REG(hw, IXGBE_PFMBICR(index),
742 static void ixgbe_clear_ack_pf(struct ixgbe_hw *hw, u16 vf_id)
748 pfmbicr = IXGBE_READ_REG(hw, IXGBE_PFMBICR(index));
751 IXGBE_EVC_ADD(&hw->mbx.stats.acks, 1);
753 IXGBE_WRITE_REG(hw, IXGBE_PFMBICR(index),
757 static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index)
759 u32 pfmbicr = IXGBE_READ_REG(hw, IXGBE_PFMBICR(index));
769 * @hw: pointer to the HW structure
774 static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_id)
781 if (!ixgbe_check_for_bit_pf(hw, IXGBE_PFMBICR_VFREQ_VF1 << vf_shift,
790 * @hw: pointer to the HW structure
795 static s32 ixgbe_check_for_ack_pf(struct ixgbe_hw *hw, u16 vf_id)
803 if (!ixgbe_check_for_bit_pf(hw, IXGBE_PFMBICR_VFACK_VF1 << vf_shift,
807 ixgbe_clear_ack_pf(hw, vf_id);
815 * @hw: pointer to the HW structure
820 static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_id)
829 switch (hw->mac.type) {
831 vflre = IXGBE_READ_REG(hw, IXGBE_PFVFLRE(index));
837 vflre = IXGBE_READ_REG(hw, IXGBE_PFVFLREC(index));
845 IXGBE_WRITE_REG(hw, IXGBE_PFVFLREC(index), (1 << vf_shift));
846 IXGBE_EVC_ADD(&hw->mbx.stats.rsts, 1);
854 * @hw: pointer to the HW structure
859 static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_id)
861 struct ixgbe_mbx_info *mbx = &hw->mbx;
873 pf_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_id));
875 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_id), pf_mailbox);
878 pf_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_id));
899 * @hw: pointer to the HW structure
902 static void ixgbe_release_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_id)
909 pf_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_id));
911 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_id), pf_mailbox);
916 * @hw: pointer to the HW structure
923 static s32 ixgbe_write_mbx_pf_legacy(struct ixgbe_hw *hw, u32 *msg, u16 size,
932 ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_id);
937 ixgbe_check_for_msg_pf(hw, vf_id);
938 ixgbe_clear_msg_pf(hw, vf_id);
939 ixgbe_check_for_ack_pf(hw, vf_id);
940 ixgbe_clear_ack_pf(hw, vf_id);
944 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_id), i, msg[i]);
947 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_id), IXGBE_PFMAILBOX_STS);
950 IXGBE_EVC_ADD(&hw->mbx.stats.msgs_tx, 1);
957 * @hw: pointer to the HW structure
964 static s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
974 ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_id);
979 ixgbe_clear_msg_pf(hw, vf_id);
980 ixgbe_clear_ack_pf(hw, vf_id);
984 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_id), i, msg[i]);
987 pf_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_id));
989 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_id), pf_mailbox);
992 ixgbe_poll_for_ack(hw, vf_id);
995 IXGBE_EVC_ADD(&hw->mbx.stats.msgs_tx, 1);
998 hw->mbx.ops[vf_id].release(hw, vf_id);
1006 * @hw: pointer to the HW structure
1015 static s32 ixgbe_read_mbx_pf_legacy(struct ixgbe_hw *hw, u32 *msg, u16 size,
1024 ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_id);
1030 msg[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_id), i);
1033 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_id), IXGBE_PFMAILBOX_ACK);
1036 IXGBE_EVC_ADD(&hw->mbx.stats.msgs_rx, 1);
1043 * @hw: pointer to the HW structure
1052 static s32 ixgbe_read_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
1062 ret_val = ixgbe_check_for_msg_pf(hw, vf_id);
1066 ixgbe_clear_msg_pf(hw, vf_id);
1070 msg[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_id), i);
1073 pf_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_id));
1075 IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_id), pf_mailbox);
1078 IXGBE_EVC_ADD(&hw->mbx.stats.msgs_rx, 1);
1085 * @hw: pointer to the HW structure
1090 static s32 ixgbe_clear_mbx_pf(struct ixgbe_hw *hw, u16 vf_id)
1092 u16 mbx_size = hw->mbx.size;
1099 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_id), i, 0x0);
1106 * @hw: pointer to the HW structure
1109 * Initializes single set of the hw->mbx struct to correct values for pf mailbox
1112 void ixgbe_init_mbx_params_pf_id(struct ixgbe_hw *hw, u16 vf_id)
1114 struct ixgbe_mbx_info *mbx = &hw->mbx;
1127 * @hw: pointer to the HW structure
1129 * Initializes all sets of the hw->mbx struct to correct values for pf
1133 void ixgbe_init_mbx_params_pf(struct ixgbe_hw *hw)
1136 struct ixgbe_mbx_info *mbx = &hw->mbx;
1139 if (hw->mac.type != ixgbe_mac_82599EB &&
1140 hw->mac.type != ixgbe_mac_X550 &&
1141 hw->mac.type != ixgbe_mac_X550EM_x &&
1142 hw->mac.type != ixgbe_mac_X550EM_a &&
1143 hw->mac.type != ixgbe_mac_X540)
1165 ixgbe_init_mbx_params_pf_id(hw, i);
1170 * @hw: pointer to the HW structure
1173 * Initializes the hw->mbx struct to new function set for improved
1176 void ixgbe_upgrade_mbx_params_pf(struct ixgbe_hw *hw, u16 vf_id)
1178 struct ixgbe_mbx_info *mbx = &hw->mbx;
1181 if (hw->mac.type != ixgbe_mac_82599EB &&
1182 hw->mac.type != ixgbe_mac_X550 &&
1183 hw->mac.type != ixgbe_mac_X550EM_x &&
1184 hw->mac.type != ixgbe_mac_X550EM_a &&
1185 hw->mac.type != ixgbe_mac_X540)