Lines Matching full:hw
41 static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw);
42 static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw);
43 static void ixgbe_release_eeprom_semaphore(struct ixgbe_hw *hw);
44 static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw);
45 static void ixgbe_standby_eeprom(struct ixgbe_hw *hw);
46 static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw *hw, u16 data,
48 static u16 ixgbe_shift_in_eeprom_bits(struct ixgbe_hw *hw, u16 count);
49 static void ixgbe_raise_eeprom_clk(struct ixgbe_hw *hw, u32 *eec);
50 static void ixgbe_lower_eeprom_clk(struct ixgbe_hw *hw, u32 *eec);
51 static void ixgbe_release_eeprom(struct ixgbe_hw *hw);
53 static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr);
54 static s32 ixgbe_get_san_mac_addr_offset(struct ixgbe_hw *hw,
56 static s32 ixgbe_read_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset,
58 static s32 ixgbe_write_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset,
60 static s32 ixgbe_detect_eeprom_page_size_generic(struct ixgbe_hw *hw,
65 * @hw: pointer to the hardware structure
69 s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw) in ixgbe_init_ops_generic() argument
71 struct ixgbe_eeprom_info *eeprom = &hw->eeprom; in ixgbe_init_ops_generic()
72 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_init_ops_generic()
73 u32 eec = IXGBE_READ_REG(hw, IXGBE_EEC_BY_MAC(hw)); in ixgbe_init_ops_generic()
157 * @hw: pointer to hardware structure
163 bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw) in ixgbe_device_supports_autoneg_fc() argument
171 switch (hw->phy.media_type) { in ixgbe_device_supports_autoneg_fc()
176 switch (hw->device_id) { in ixgbe_device_supports_autoneg_fc()
184 hw->mac.ops.check_link(hw, &speed, &link_up, false); in ixgbe_device_supports_autoneg_fc()
195 if (hw->device_id == IXGBE_DEV_ID_X550EM_X_XFI) in ixgbe_device_supports_autoneg_fc()
202 switch (hw->device_id) { in ixgbe_device_supports_autoneg_fc()
225 hw->device_id); in ixgbe_device_supports_autoneg_fc()
232 * @hw: pointer to hardware structure
236 s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw) in ixgbe_setup_fc_generic() argument
246 if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { in ixgbe_setup_fc_generic()
257 if (hw->fc.requested_mode == ixgbe_fc_default) in ixgbe_setup_fc_generic()
258 hw->fc.requested_mode = ixgbe_fc_full; in ixgbe_setup_fc_generic()
262 * HW will be able to do fc autoneg once the cable is plugged in. If in ixgbe_setup_fc_generic()
265 switch (hw->phy.media_type) { in ixgbe_setup_fc_generic()
268 ret_val = hw->mac.ops.prot_autoc_read(hw, &locked, ®_bp); in ixgbe_setup_fc_generic()
272 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); in ixgbe_setup_fc_generic()
277 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); in ixgbe_setup_fc_generic()
281 hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_ADVT, in ixgbe_setup_fc_generic()
298 switch (hw->fc.requested_mode) { in ixgbe_setup_fc_generic()
302 if (hw->phy.media_type == ixgbe_media_type_backplane) in ixgbe_setup_fc_generic()
305 else if (hw->phy.media_type == ixgbe_media_type_copper) in ixgbe_setup_fc_generic()
315 if (hw->phy.media_type == ixgbe_media_type_backplane) { in ixgbe_setup_fc_generic()
318 } else if (hw->phy.media_type == ixgbe_media_type_copper) { in ixgbe_setup_fc_generic()
336 if (hw->phy.media_type == ixgbe_media_type_backplane) in ixgbe_setup_fc_generic()
339 else if (hw->phy.media_type == ixgbe_media_type_copper) in ixgbe_setup_fc_generic()
350 if (hw->mac.type < ixgbe_mac_X540) { in ixgbe_setup_fc_generic()
355 IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg); in ixgbe_setup_fc_generic()
356 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); in ixgbe_setup_fc_generic()
359 if (hw->fc.strict_ieee) in ixgbe_setup_fc_generic()
362 IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg); in ixgbe_setup_fc_generic()
371 if (hw->phy.media_type == ixgbe_media_type_backplane) { in ixgbe_setup_fc_generic()
373 ret_val = hw->mac.ops.prot_autoc_write(hw, reg_bp, locked); in ixgbe_setup_fc_generic()
376 } else if ((hw->phy.media_type == ixgbe_media_type_copper) && in ixgbe_setup_fc_generic()
377 (ixgbe_device_supports_autoneg_fc(hw))) { in ixgbe_setup_fc_generic()
378 hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_ADVT, in ixgbe_setup_fc_generic()
389 * @hw: pointer to hardware structure
396 s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw) in ixgbe_start_hw_generic() argument
405 hw->phy.media_type = hw->mac.ops.get_media_type(hw); in ixgbe_start_hw_generic()
410 hw->mac.ops.clear_vfta(hw); in ixgbe_start_hw_generic()
413 hw->mac.ops.clear_hw_cntrs(hw); in ixgbe_start_hw_generic()
416 ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); in ixgbe_start_hw_generic()
418 IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); in ixgbe_start_hw_generic()
419 IXGBE_WRITE_FLUSH(hw); in ixgbe_start_hw_generic()
422 ret_val = ixgbe_setup_fc(hw); in ixgbe_start_hw_generic()
429 switch (hw->mac.type) { in ixgbe_start_hw_generic()
433 hw->mac.ops.get_device_caps(hw, &device_caps); in ixgbe_start_hw_generic()
435 hw->need_crosstalk_fix = false; in ixgbe_start_hw_generic()
437 hw->need_crosstalk_fix = true; in ixgbe_start_hw_generic()
440 hw->need_crosstalk_fix = false; in ixgbe_start_hw_generic()
445 hw->adapter_stopped = false; in ixgbe_start_hw_generic()
452 * @hw: pointer to hw structure
460 void ixgbe_start_hw_gen2(struct ixgbe_hw *hw) in ixgbe_start_hw_gen2() argument
466 for (i = 0; i < hw->mac.max_tx_queues; i++) { in ixgbe_start_hw_gen2()
467 IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, i); in ixgbe_start_hw_gen2()
468 IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, 0); in ixgbe_start_hw_gen2()
470 IXGBE_WRITE_FLUSH(hw); in ixgbe_start_hw_gen2()
473 for (i = 0; i < hw->mac.max_tx_queues; i++) { in ixgbe_start_hw_gen2()
474 regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(i)); in ixgbe_start_hw_gen2()
476 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(i), regval); in ixgbe_start_hw_gen2()
479 for (i = 0; i < hw->mac.max_rx_queues; i++) { in ixgbe_start_hw_gen2()
480 regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i)); in ixgbe_start_hw_gen2()
483 IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval); in ixgbe_start_hw_gen2()
489 * @hw: pointer to hardware structure
497 s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw) in ixgbe_init_hw_generic() argument
504 status = hw->mac.ops.reset_hw(hw); in ixgbe_init_hw_generic()
507 /* Start the HW */ in ixgbe_init_hw_generic()
508 status = hw->mac.ops.start_hw(hw); in ixgbe_init_hw_generic()
512 if (hw->mac.ops.init_led_link_act) in ixgbe_init_hw_generic()
513 hw->mac.ops.init_led_link_act(hw); in ixgbe_init_hw_generic()
516 DEBUGOUT1("Failed to initialize HW, STATUS = %d\n", status); in ixgbe_init_hw_generic()
523 * @hw: pointer to hardware structure
528 s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw) in ixgbe_clear_hw_cntrs_generic() argument
534 IXGBE_READ_REG(hw, IXGBE_CRCERRS); in ixgbe_clear_hw_cntrs_generic()
535 IXGBE_READ_REG(hw, IXGBE_ILLERRC); in ixgbe_clear_hw_cntrs_generic()
536 IXGBE_READ_REG(hw, IXGBE_ERRBC); in ixgbe_clear_hw_cntrs_generic()
537 IXGBE_READ_REG(hw, IXGBE_MSPDC); in ixgbe_clear_hw_cntrs_generic()
539 IXGBE_READ_REG(hw, IXGBE_MPC(i)); in ixgbe_clear_hw_cntrs_generic()
541 IXGBE_READ_REG(hw, IXGBE_MLFC); in ixgbe_clear_hw_cntrs_generic()
542 IXGBE_READ_REG(hw, IXGBE_MRFC); in ixgbe_clear_hw_cntrs_generic()
543 IXGBE_READ_REG(hw, IXGBE_RLEC); in ixgbe_clear_hw_cntrs_generic()
544 IXGBE_READ_REG(hw, IXGBE_LXONTXC); in ixgbe_clear_hw_cntrs_generic()
545 IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); in ixgbe_clear_hw_cntrs_generic()
546 if (hw->mac.type >= ixgbe_mac_82599EB) { in ixgbe_clear_hw_cntrs_generic()
547 IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); in ixgbe_clear_hw_cntrs_generic()
548 IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); in ixgbe_clear_hw_cntrs_generic()
550 IXGBE_READ_REG(hw, IXGBE_LXONRXC); in ixgbe_clear_hw_cntrs_generic()
551 IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); in ixgbe_clear_hw_cntrs_generic()
555 IXGBE_READ_REG(hw, IXGBE_PXONTXC(i)); in ixgbe_clear_hw_cntrs_generic()
556 IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(i)); in ixgbe_clear_hw_cntrs_generic()
557 if (hw->mac.type >= ixgbe_mac_82599EB) { in ixgbe_clear_hw_cntrs_generic()
558 IXGBE_READ_REG(hw, IXGBE_PXONRXCNT(i)); in ixgbe_clear_hw_cntrs_generic()
559 IXGBE_READ_REG(hw, IXGBE_PXOFFRXCNT(i)); in ixgbe_clear_hw_cntrs_generic()
561 IXGBE_READ_REG(hw, IXGBE_PXONRXC(i)); in ixgbe_clear_hw_cntrs_generic()
562 IXGBE_READ_REG(hw, IXGBE_PXOFFRXC(i)); in ixgbe_clear_hw_cntrs_generic()
565 if (hw->mac.type >= ixgbe_mac_82599EB) in ixgbe_clear_hw_cntrs_generic()
567 IXGBE_READ_REG(hw, IXGBE_PXON2OFFCNT(i)); in ixgbe_clear_hw_cntrs_generic()
568 IXGBE_READ_REG(hw, IXGBE_PRC64); in ixgbe_clear_hw_cntrs_generic()
569 IXGBE_READ_REG(hw, IXGBE_PRC127); in ixgbe_clear_hw_cntrs_generic()
570 IXGBE_READ_REG(hw, IXGBE_PRC255); in ixgbe_clear_hw_cntrs_generic()
571 IXGBE_READ_REG(hw, IXGBE_PRC511); in ixgbe_clear_hw_cntrs_generic()
572 IXGBE_READ_REG(hw, IXGBE_PRC1023); in ixgbe_clear_hw_cntrs_generic()
573 IXGBE_READ_REG(hw, IXGBE_PRC1522); in ixgbe_clear_hw_cntrs_generic()
574 IXGBE_READ_REG(hw, IXGBE_GPRC); in ixgbe_clear_hw_cntrs_generic()
575 IXGBE_READ_REG(hw, IXGBE_BPRC); in ixgbe_clear_hw_cntrs_generic()
576 IXGBE_READ_REG(hw, IXGBE_MPRC); in ixgbe_clear_hw_cntrs_generic()
577 IXGBE_READ_REG(hw, IXGBE_GPTC); in ixgbe_clear_hw_cntrs_generic()
578 IXGBE_READ_REG(hw, IXGBE_GORCL); in ixgbe_clear_hw_cntrs_generic()
579 IXGBE_READ_REG(hw, IXGBE_GORCH); in ixgbe_clear_hw_cntrs_generic()
580 IXGBE_READ_REG(hw, IXGBE_GOTCL); in ixgbe_clear_hw_cntrs_generic()
581 IXGBE_READ_REG(hw, IXGBE_GOTCH); in ixgbe_clear_hw_cntrs_generic()
582 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_clear_hw_cntrs_generic()
584 IXGBE_READ_REG(hw, IXGBE_RNBC(i)); in ixgbe_clear_hw_cntrs_generic()
585 IXGBE_READ_REG(hw, IXGBE_RUC); in ixgbe_clear_hw_cntrs_generic()
586 IXGBE_READ_REG(hw, IXGBE_RFC); in ixgbe_clear_hw_cntrs_generic()
587 IXGBE_READ_REG(hw, IXGBE_ROC); in ixgbe_clear_hw_cntrs_generic()
588 IXGBE_READ_REG(hw, IXGBE_RJC); in ixgbe_clear_hw_cntrs_generic()
589 IXGBE_READ_REG(hw, IXGBE_MNGPRC); in ixgbe_clear_hw_cntrs_generic()
590 IXGBE_READ_REG(hw, IXGBE_MNGPDC); in ixgbe_clear_hw_cntrs_generic()
591 IXGBE_READ_REG(hw, IXGBE_MNGPTC); in ixgbe_clear_hw_cntrs_generic()
592 IXGBE_READ_REG(hw, IXGBE_TORL); in ixgbe_clear_hw_cntrs_generic()
593 IXGBE_READ_REG(hw, IXGBE_TORH); in ixgbe_clear_hw_cntrs_generic()
594 IXGBE_READ_REG(hw, IXGBE_TPR); in ixgbe_clear_hw_cntrs_generic()
595 IXGBE_READ_REG(hw, IXGBE_TPT); in ixgbe_clear_hw_cntrs_generic()
596 IXGBE_READ_REG(hw, IXGBE_PTC64); in ixgbe_clear_hw_cntrs_generic()
597 IXGBE_READ_REG(hw, IXGBE_PTC127); in ixgbe_clear_hw_cntrs_generic()
598 IXGBE_READ_REG(hw, IXGBE_PTC255); in ixgbe_clear_hw_cntrs_generic()
599 IXGBE_READ_REG(hw, IXGBE_PTC511); in ixgbe_clear_hw_cntrs_generic()
600 IXGBE_READ_REG(hw, IXGBE_PTC1023); in ixgbe_clear_hw_cntrs_generic()
601 IXGBE_READ_REG(hw, IXGBE_PTC1522); in ixgbe_clear_hw_cntrs_generic()
602 IXGBE_READ_REG(hw, IXGBE_MPTC); in ixgbe_clear_hw_cntrs_generic()
603 IXGBE_READ_REG(hw, IXGBE_BPTC); in ixgbe_clear_hw_cntrs_generic()
605 IXGBE_READ_REG(hw, IXGBE_QPRC(i)); in ixgbe_clear_hw_cntrs_generic()
606 IXGBE_READ_REG(hw, IXGBE_QPTC(i)); in ixgbe_clear_hw_cntrs_generic()
607 if (hw->mac.type >= ixgbe_mac_82599EB) { in ixgbe_clear_hw_cntrs_generic()
608 IXGBE_READ_REG(hw, IXGBE_QBRC_L(i)); in ixgbe_clear_hw_cntrs_generic()
609 IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)); in ixgbe_clear_hw_cntrs_generic()
610 IXGBE_READ_REG(hw, IXGBE_QBTC_L(i)); in ixgbe_clear_hw_cntrs_generic()
611 IXGBE_READ_REG(hw, IXGBE_QBTC_H(i)); in ixgbe_clear_hw_cntrs_generic()
612 IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); in ixgbe_clear_hw_cntrs_generic()
614 IXGBE_READ_REG(hw, IXGBE_QBRC(i)); in ixgbe_clear_hw_cntrs_generic()
615 IXGBE_READ_REG(hw, IXGBE_QBTC(i)); in ixgbe_clear_hw_cntrs_generic()
619 if (hw->mac.type == ixgbe_mac_X550 || hw->mac.type == ixgbe_mac_X540) { in ixgbe_clear_hw_cntrs_generic()
620 if (hw->phy.id == 0) in ixgbe_clear_hw_cntrs_generic()
621 ixgbe_identify_phy(hw); in ixgbe_clear_hw_cntrs_generic()
622 hw->phy.ops.read_reg(hw, IXGBE_PCRC8ECL, in ixgbe_clear_hw_cntrs_generic()
624 hw->phy.ops.read_reg(hw, IXGBE_PCRC8ECH, in ixgbe_clear_hw_cntrs_generic()
626 hw->phy.ops.read_reg(hw, IXGBE_LDPCECL, in ixgbe_clear_hw_cntrs_generic()
628 hw->phy.ops.read_reg(hw, IXGBE_LDPCECH, in ixgbe_clear_hw_cntrs_generic()
637 * @hw: pointer to hardware structure
643 s32 ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, u8 *pba_num, in ixgbe_read_pba_string_generic() argument
659 ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM0_PTR, &data); in ixgbe_read_pba_string_generic()
665 ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM1_PTR, &pba_ptr); in ixgbe_read_pba_string_generic()
711 ret_val = hw->eeprom.ops.read(hw, pba_ptr, &length); in ixgbe_read_pba_string_generic()
717 if (length == 0xFFFF || length == 0 || length > hw->eeprom.word_size) { in ixgbe_read_pba_string_generic()
733 ret_val = hw->eeprom.ops.read(hw, pba_ptr + offset, &data); in ixgbe_read_pba_string_generic()
748 * @hw: pointer to hardware structure
753 s32 ixgbe_read_pba_num_generic(struct ixgbe_hw *hw, u32 *pba_num) in ixgbe_read_pba_num_generic() argument
760 ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM0_PTR, &data); in ixgbe_read_pba_num_generic()
770 ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM1_PTR, &data); in ixgbe_read_pba_num_generic()
782 * @hw: pointer to the HW structure
792 s32 ixgbe_read_pba_raw(struct ixgbe_hw *hw, u16 *eeprom_buf, in ixgbe_read_pba_raw() argument
803 ret_val = hw->eeprom.ops.read_buffer(hw, IXGBE_PBANUM0_PTR, 2, in ixgbe_read_pba_raw()
820 ret_val = ixgbe_get_pba_block_size(hw, eeprom_buf, in ixgbe_read_pba_raw()
830 ret_val = hw->eeprom.ops.read_buffer(hw, pba->word[1], in ixgbe_read_pba_raw()
852 * @hw: pointer to the HW structure
861 s32 ixgbe_write_pba_raw(struct ixgbe_hw *hw, u16 *eeprom_buf, in ixgbe_write_pba_raw() argument
870 ret_val = hw->eeprom.ops.write_buffer(hw, IXGBE_PBANUM0_PTR, 2, in ixgbe_write_pba_raw()
888 ret_val = hw->eeprom.ops.write_buffer(hw, pba->word[1], in ixgbe_write_pba_raw()
910 * @hw: pointer to the HW structure
920 s32 ixgbe_get_pba_block_size(struct ixgbe_hw *hw, u16 *eeprom_buf, in ixgbe_get_pba_block_size() argument
930 ret_val = hw->eeprom.ops.read_buffer(hw, IXGBE_PBANUM0_PTR, 2, in ixgbe_get_pba_block_size()
945 ret_val = hw->eeprom.ops.read(hw, pba_word[1] + 0, in ixgbe_get_pba_block_size()
971 * @hw: pointer to hardware structure
978 s32 ixgbe_get_mac_addr_generic(struct ixgbe_hw *hw, u8 *mac_addr) in ixgbe_get_mac_addr_generic() argument
986 rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(0)); in ixgbe_get_mac_addr_generic()
987 rar_low = IXGBE_READ_REG(hw, IXGBE_RAL(0)); in ixgbe_get_mac_addr_generic()
1000 * @hw: pointer to hardware structure
1005 void ixgbe_set_pci_config_data_generic(struct ixgbe_hw *hw, u16 link_status) in ixgbe_set_pci_config_data_generic() argument
1007 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_set_pci_config_data_generic()
1009 if (hw->bus.type == ixgbe_bus_type_unknown) in ixgbe_set_pci_config_data_generic()
1010 hw->bus.type = ixgbe_bus_type_pci_express; in ixgbe_set_pci_config_data_generic()
1014 hw->bus.width = ixgbe_bus_width_pcie_x1; in ixgbe_set_pci_config_data_generic()
1017 hw->bus.width = ixgbe_bus_width_pcie_x2; in ixgbe_set_pci_config_data_generic()
1020 hw->bus.width = ixgbe_bus_width_pcie_x4; in ixgbe_set_pci_config_data_generic()
1023 hw->bus.width = ixgbe_bus_width_pcie_x8; in ixgbe_set_pci_config_data_generic()
1026 hw->bus.width = ixgbe_bus_width_unknown; in ixgbe_set_pci_config_data_generic()
1032 hw->bus.speed = ixgbe_bus_speed_2500; in ixgbe_set_pci_config_data_generic()
1035 hw->bus.speed = ixgbe_bus_speed_5000; in ixgbe_set_pci_config_data_generic()
1038 hw->bus.speed = ixgbe_bus_speed_8000; in ixgbe_set_pci_config_data_generic()
1041 hw->bus.speed = ixgbe_bus_speed_unknown; in ixgbe_set_pci_config_data_generic()
1045 mac->ops.set_lan_id(hw); in ixgbe_set_pci_config_data_generic()
1050 * @hw: pointer to hardware structure
1055 s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw) in ixgbe_get_bus_info_generic() argument
1062 link_status = IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_LINK_STATUS); in ixgbe_get_bus_info_generic()
1064 ixgbe_set_pci_config_data_generic(hw, link_status); in ixgbe_get_bus_info_generic()
1071 * @hw: pointer to the HW structure
1077 void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw) in ixgbe_set_lan_id_multi_port_pcie() argument
1079 struct ixgbe_bus_info *bus = &hw->bus; in ixgbe_set_lan_id_multi_port_pcie()
1085 reg = IXGBE_READ_REG(hw, IXGBE_STATUS); in ixgbe_set_lan_id_multi_port_pcie()
1090 reg = IXGBE_READ_REG(hw, IXGBE_FACTPS_BY_MAC(hw)); in ixgbe_set_lan_id_multi_port_pcie()
1095 if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP) { in ixgbe_set_lan_id_multi_port_pcie()
1096 hw->eeprom.ops.read(hw, IXGBE_EEPROM_CTRL_4, &ee_ctrl_4); in ixgbe_set_lan_id_multi_port_pcie()
1104 * @hw: pointer to hardware structure
1111 s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw) in ixgbe_stop_adapter_generic() argument
1122 hw->adapter_stopped = true; in ixgbe_stop_adapter_generic()
1125 ixgbe_disable_rx(hw); in ixgbe_stop_adapter_generic()
1128 IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_IRQ_CLEAR_MASK); in ixgbe_stop_adapter_generic()
1131 IXGBE_READ_REG(hw, IXGBE_EICR); in ixgbe_stop_adapter_generic()
1134 for (i = 0; i < hw->mac.max_tx_queues; i++) in ixgbe_stop_adapter_generic()
1135 IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(i), IXGBE_TXDCTL_SWFLSH); in ixgbe_stop_adapter_generic()
1138 for (i = 0; i < hw->mac.max_rx_queues; i++) { in ixgbe_stop_adapter_generic()
1139 reg_val = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i)); in ixgbe_stop_adapter_generic()
1142 IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(i), reg_val); in ixgbe_stop_adapter_generic()
1146 IXGBE_WRITE_FLUSH(hw); in ixgbe_stop_adapter_generic()
1153 return ixgbe_disable_pcie_primary(hw); in ixgbe_stop_adapter_generic()
1158 * @hw: pointer to hardware structure
1163 s32 ixgbe_init_led_link_act_generic(struct ixgbe_hw *hw) in ixgbe_init_led_link_act_generic() argument
1165 struct ixgbe_mac_info *mac = &hw->mac; in ixgbe_init_led_link_act_generic()
1169 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_init_led_link_act_generic()
1186 switch (hw->mac.type) { in ixgbe_init_led_link_act_generic()
1199 * @hw: pointer to hardware structure
1202 s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index) in ixgbe_led_on_generic() argument
1204 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_led_on_generic()
1214 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); in ixgbe_led_on_generic()
1215 IXGBE_WRITE_FLUSH(hw); in ixgbe_led_on_generic()
1222 * @hw: pointer to hardware structure
1225 s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index) in ixgbe_led_off_generic() argument
1227 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_led_off_generic()
1237 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); in ixgbe_led_off_generic()
1238 IXGBE_WRITE_FLUSH(hw); in ixgbe_led_off_generic()
1245 * @hw: pointer to hardware structure
1250 s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw) in ixgbe_init_eeprom_params_generic() argument
1252 struct ixgbe_eeprom_info *eeprom = &hw->eeprom; in ixgbe_init_eeprom_params_generic()
1270 eec = IXGBE_READ_REG(hw, IXGBE_EEC_BY_MAC(hw)); in ixgbe_init_eeprom_params_generic()
1298 * @hw: pointer to hardware structure
1305 s32 ixgbe_write_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, in ixgbe_write_eeprom_buffer_bit_bang_generic() argument
1313 hw->eeprom.ops.init_params(hw); in ixgbe_write_eeprom_buffer_bit_bang_generic()
1320 if (offset + words > hw->eeprom.word_size) { in ixgbe_write_eeprom_buffer_bit_bang_generic()
1329 if ((hw->eeprom.word_page_size == 0) && in ixgbe_write_eeprom_buffer_bit_bang_generic()
1331 ixgbe_detect_eeprom_page_size_generic(hw, offset); in ixgbe_write_eeprom_buffer_bit_bang_generic()
1341 status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset + i, in ixgbe_write_eeprom_buffer_bit_bang_generic()
1354 * @hw: pointer to hardware structure
1362 static s32 ixgbe_write_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, in ixgbe_write_eeprom_buffer_bit_bang() argument
1374 status = ixgbe_acquire_eeprom(hw); in ixgbe_write_eeprom_buffer_bit_bang()
1377 if (ixgbe_ready_eeprom(hw) != IXGBE_SUCCESS) { in ixgbe_write_eeprom_buffer_bit_bang()
1378 ixgbe_release_eeprom(hw); in ixgbe_write_eeprom_buffer_bit_bang()
1385 ixgbe_standby_eeprom(hw); in ixgbe_write_eeprom_buffer_bit_bang()
1388 ixgbe_shift_out_eeprom_bits(hw, in ixgbe_write_eeprom_buffer_bit_bang()
1392 ixgbe_standby_eeprom(hw); in ixgbe_write_eeprom_buffer_bit_bang()
1398 if ((hw->eeprom.address_bits == 8) && in ixgbe_write_eeprom_buffer_bit_bang()
1403 ixgbe_shift_out_eeprom_bits(hw, write_opcode, in ixgbe_write_eeprom_buffer_bit_bang()
1405 ixgbe_shift_out_eeprom_bits(hw, (u16)((offset + i) * 2), in ixgbe_write_eeprom_buffer_bit_bang()
1406 hw->eeprom.address_bits); in ixgbe_write_eeprom_buffer_bit_bang()
1408 page_size = hw->eeprom.word_page_size; in ixgbe_write_eeprom_buffer_bit_bang()
1414 ixgbe_shift_out_eeprom_bits(hw, word, 16); in ixgbe_write_eeprom_buffer_bit_bang()
1425 ixgbe_standby_eeprom(hw); in ixgbe_write_eeprom_buffer_bit_bang()
1429 ixgbe_release_eeprom(hw); in ixgbe_write_eeprom_buffer_bit_bang()
1437 * @hw: pointer to hardware structure
1444 s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data) in ixgbe_write_eeprom_generic() argument
1450 hw->eeprom.ops.init_params(hw); in ixgbe_write_eeprom_generic()
1452 if (offset >= hw->eeprom.word_size) { in ixgbe_write_eeprom_generic()
1457 status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset, 1, &data); in ixgbe_write_eeprom_generic()
1465 * @hw: pointer to hardware structure
1472 s32 ixgbe_read_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, in ixgbe_read_eeprom_buffer_bit_bang_generic() argument
1480 hw->eeprom.ops.init_params(hw); in ixgbe_read_eeprom_buffer_bit_bang_generic()
1487 if (offset + words > hw->eeprom.word_size) { in ixgbe_read_eeprom_buffer_bit_bang_generic()
1501 status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset + i, in ixgbe_read_eeprom_buffer_bit_bang_generic()
1514 * @hw: pointer to hardware structure
1521 static s32 ixgbe_read_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, in ixgbe_read_eeprom_buffer_bit_bang() argument
1532 status = ixgbe_acquire_eeprom(hw); in ixgbe_read_eeprom_buffer_bit_bang()
1535 if (ixgbe_ready_eeprom(hw) != IXGBE_SUCCESS) { in ixgbe_read_eeprom_buffer_bit_bang()
1536 ixgbe_release_eeprom(hw); in ixgbe_read_eeprom_buffer_bit_bang()
1543 ixgbe_standby_eeprom(hw); in ixgbe_read_eeprom_buffer_bit_bang()
1548 if ((hw->eeprom.address_bits == 8) && in ixgbe_read_eeprom_buffer_bit_bang()
1553 ixgbe_shift_out_eeprom_bits(hw, read_opcode, in ixgbe_read_eeprom_buffer_bit_bang()
1555 ixgbe_shift_out_eeprom_bits(hw, (u16)((offset + i) * 2), in ixgbe_read_eeprom_buffer_bit_bang()
1556 hw->eeprom.address_bits); in ixgbe_read_eeprom_buffer_bit_bang()
1559 word_in = ixgbe_shift_in_eeprom_bits(hw, 16); in ixgbe_read_eeprom_buffer_bit_bang()
1564 ixgbe_release_eeprom(hw); in ixgbe_read_eeprom_buffer_bit_bang()
1572 * @hw: pointer to hardware structure
1578 s32 ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, in ixgbe_read_eeprom_bit_bang_generic() argument
1585 hw->eeprom.ops.init_params(hw); in ixgbe_read_eeprom_bit_bang_generic()
1587 if (offset >= hw->eeprom.word_size) { in ixgbe_read_eeprom_bit_bang_generic()
1592 status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset, 1, data); in ixgbe_read_eeprom_bit_bang_generic()
1600 * @hw: pointer to hardware structure
1607 s32 ixgbe_read_eerd_buffer_generic(struct ixgbe_hw *hw, u16 offset, in ixgbe_read_eerd_buffer_generic() argument
1616 hw->eeprom.ops.init_params(hw); in ixgbe_read_eerd_buffer_generic()
1624 if (offset >= hw->eeprom.word_size) { in ixgbe_read_eerd_buffer_generic()
1634 IXGBE_WRITE_REG(hw, IXGBE_EERD, eerd); in ixgbe_read_eerd_buffer_generic()
1635 status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_READ); in ixgbe_read_eerd_buffer_generic()
1638 data[i] = (IXGBE_READ_REG(hw, IXGBE_EERD) >> in ixgbe_read_eerd_buffer_generic()
1651 * @hw: pointer to hardware structure
1658 static s32 ixgbe_detect_eeprom_page_size_generic(struct ixgbe_hw *hw, in ixgbe_detect_eeprom_page_size_generic() argument
1670 hw->eeprom.word_page_size = IXGBE_EEPROM_PAGE_SIZE_MAX; in ixgbe_detect_eeprom_page_size_generic()
1671 status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset, in ixgbe_detect_eeprom_page_size_generic()
1673 hw->eeprom.word_page_size = 0; in ixgbe_detect_eeprom_page_size_generic()
1677 status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset, 1, data); in ixgbe_detect_eeprom_page_size_generic()
1685 hw->eeprom.word_page_size = IXGBE_EEPROM_PAGE_SIZE_MAX - data[0]; in ixgbe_detect_eeprom_page_size_generic()
1688 hw->eeprom.word_page_size); in ixgbe_detect_eeprom_page_size_generic()
1695 * @hw: pointer to hardware structure
1701 s32 ixgbe_read_eerd_generic(struct ixgbe_hw *hw, u16 offset, u16 *data) in ixgbe_read_eerd_generic() argument
1703 return ixgbe_read_eerd_buffer_generic(hw, offset, 1, data); in ixgbe_read_eerd_generic()
1708 * @hw: pointer to hardware structure
1715 s32 ixgbe_write_eewr_buffer_generic(struct ixgbe_hw *hw, u16 offset, in ixgbe_write_eewr_buffer_generic() argument
1724 hw->eeprom.ops.init_params(hw); in ixgbe_write_eewr_buffer_generic()
1732 if (offset >= hw->eeprom.word_size) { in ixgbe_write_eewr_buffer_generic()
1743 status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_WRITE); in ixgbe_write_eewr_buffer_generic()
1749 IXGBE_WRITE_REG(hw, IXGBE_EEWR, eewr); in ixgbe_write_eewr_buffer_generic()
1751 status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_WRITE); in ixgbe_write_eewr_buffer_generic()
1764 * @hw: pointer to hardware structure
1770 s32 ixgbe_write_eewr_generic(struct ixgbe_hw *hw, u16 offset, u16 data) in ixgbe_write_eewr_generic() argument
1772 return ixgbe_write_eewr_buffer_generic(hw, offset, 1, &data); in ixgbe_write_eewr_generic()
1777 * @hw: pointer to hardware structure
1783 s32 ixgbe_poll_eerd_eewr_done(struct ixgbe_hw *hw, u32 ee_reg) in ixgbe_poll_eerd_eewr_done() argument
1793 reg = IXGBE_READ_REG(hw, IXGBE_EERD); in ixgbe_poll_eerd_eewr_done()
1795 reg = IXGBE_READ_REG(hw, IXGBE_EEWR); in ixgbe_poll_eerd_eewr_done()
1813 * @hw: pointer to hardware structure
1818 static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw) in ixgbe_acquire_eeprom() argument
1826 if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) in ixgbe_acquire_eeprom()
1831 eec = IXGBE_READ_REG(hw, IXGBE_EEC_BY_MAC(hw)); in ixgbe_acquire_eeprom()
1835 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), eec); in ixgbe_acquire_eeprom()
1838 eec = IXGBE_READ_REG(hw, IXGBE_EEC_BY_MAC(hw)); in ixgbe_acquire_eeprom()
1847 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), eec); in ixgbe_acquire_eeprom()
1850 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); in ixgbe_acquire_eeprom()
1858 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), eec); in ixgbe_acquire_eeprom()
1859 IXGBE_WRITE_FLUSH(hw); in ixgbe_acquire_eeprom()
1868 * @hw: pointer to hardware structure
1872 static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw) in ixgbe_get_eeprom_semaphore() argument
1888 swsm = IXGBE_READ_REG(hw, IXGBE_SWSM_BY_MAC(hw)); in ixgbe_get_eeprom_semaphore()
1905 ixgbe_release_eeprom_semaphore(hw); in ixgbe_get_eeprom_semaphore()
1913 swsm = IXGBE_READ_REG(hw, IXGBE_SWSM_BY_MAC(hw)); in ixgbe_get_eeprom_semaphore()
1921 swsm = IXGBE_READ_REG(hw, IXGBE_SWSM_BY_MAC(hw)); in ixgbe_get_eeprom_semaphore()
1925 IXGBE_WRITE_REG(hw, IXGBE_SWSM_BY_MAC(hw), swsm); in ixgbe_get_eeprom_semaphore()
1931 swsm = IXGBE_READ_REG(hw, IXGBE_SWSM_BY_MAC(hw)); in ixgbe_get_eeprom_semaphore()
1945 ixgbe_release_eeprom_semaphore(hw); in ixgbe_get_eeprom_semaphore()
1959 * @hw: pointer to hardware structure
1963 static void ixgbe_release_eeprom_semaphore(struct ixgbe_hw *hw) in ixgbe_release_eeprom_semaphore() argument
1969 swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); in ixgbe_release_eeprom_semaphore()
1973 IXGBE_WRITE_REG(hw, IXGBE_SWSM, swsm); in ixgbe_release_eeprom_semaphore()
1974 IXGBE_WRITE_FLUSH(hw); in ixgbe_release_eeprom_semaphore()
1979 * @hw: pointer to hardware structure
1981 static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw) in ixgbe_ready_eeprom() argument
1996 ixgbe_shift_out_eeprom_bits(hw, IXGBE_EEPROM_RDSR_OPCODE_SPI, in ixgbe_ready_eeprom()
1998 spi_stat_reg = (u8)ixgbe_shift_in_eeprom_bits(hw, 8); in ixgbe_ready_eeprom()
2003 ixgbe_standby_eeprom(hw); in ixgbe_ready_eeprom()
2020 * @hw: pointer to hardware structure
2022 static void ixgbe_standby_eeprom(struct ixgbe_hw *hw) in ixgbe_standby_eeprom() argument
2028 eec = IXGBE_READ_REG(hw, IXGBE_EEC_BY_MAC(hw)); in ixgbe_standby_eeprom()
2032 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), eec); in ixgbe_standby_eeprom()
2033 IXGBE_WRITE_FLUSH(hw); in ixgbe_standby_eeprom()
2036 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), eec); in ixgbe_standby_eeprom()
2037 IXGBE_WRITE_FLUSH(hw); in ixgbe_standby_eeprom()
2043 * @hw: pointer to hardware structure
2047 static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw *hw, u16 data, in ixgbe_shift_out_eeprom_bits() argument
2056 eec = IXGBE_READ_REG(hw, IXGBE_EEC_BY_MAC(hw)); in ixgbe_shift_out_eeprom_bits()
2077 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), eec); in ixgbe_shift_out_eeprom_bits()
2078 IXGBE_WRITE_FLUSH(hw); in ixgbe_shift_out_eeprom_bits()
2082 ixgbe_raise_eeprom_clk(hw, &eec); in ixgbe_shift_out_eeprom_bits()
2083 ixgbe_lower_eeprom_clk(hw, &eec); in ixgbe_shift_out_eeprom_bits()
2094 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), eec); in ixgbe_shift_out_eeprom_bits()
2095 IXGBE_WRITE_FLUSH(hw); in ixgbe_shift_out_eeprom_bits()
2100 * @hw: pointer to hardware structure
2103 static u16 ixgbe_shift_in_eeprom_bits(struct ixgbe_hw *hw, u16 count) in ixgbe_shift_in_eeprom_bits() argument
2118 eec = IXGBE_READ_REG(hw, IXGBE_EEC_BY_MAC(hw)); in ixgbe_shift_in_eeprom_bits()
2124 ixgbe_raise_eeprom_clk(hw, &eec); in ixgbe_shift_in_eeprom_bits()
2126 eec = IXGBE_READ_REG(hw, IXGBE_EEC_BY_MAC(hw)); in ixgbe_shift_in_eeprom_bits()
2132 ixgbe_lower_eeprom_clk(hw, &eec); in ixgbe_shift_in_eeprom_bits()
2140 * @hw: pointer to hardware structure
2143 static void ixgbe_raise_eeprom_clk(struct ixgbe_hw *hw, u32 *eec) in ixgbe_raise_eeprom_clk() argument
2152 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), *eec); in ixgbe_raise_eeprom_clk()
2153 IXGBE_WRITE_FLUSH(hw); in ixgbe_raise_eeprom_clk()
2159 * @hw: pointer to hardware structure
2162 static void ixgbe_lower_eeprom_clk(struct ixgbe_hw *hw, u32 *eec) in ixgbe_lower_eeprom_clk() argument
2171 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), *eec); in ixgbe_lower_eeprom_clk()
2172 IXGBE_WRITE_FLUSH(hw); in ixgbe_lower_eeprom_clk()
2178 * @hw: pointer to hardware structure
2180 static void ixgbe_release_eeprom(struct ixgbe_hw *hw) in ixgbe_release_eeprom() argument
2186 eec = IXGBE_READ_REG(hw, IXGBE_EEC_BY_MAC(hw)); in ixgbe_release_eeprom()
2191 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), eec); in ixgbe_release_eeprom()
2192 IXGBE_WRITE_FLUSH(hw); in ixgbe_release_eeprom()
2198 IXGBE_WRITE_REG(hw, IXGBE_EEC_BY_MAC(hw), eec); in ixgbe_release_eeprom()
2200 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); in ixgbe_release_eeprom()
2203 msec_delay(hw->eeprom.semaphore_delay); in ixgbe_release_eeprom()
2208 * @hw: pointer to hardware structure
2212 s32 ixgbe_calc_eeprom_checksum_generic(struct ixgbe_hw *hw) in ixgbe_calc_eeprom_checksum_generic() argument
2225 if (hw->eeprom.ops.read(hw, i, &word)) { in ixgbe_calc_eeprom_checksum_generic()
2234 if (hw->eeprom.ops.read(hw, i, &pointer)) { in ixgbe_calc_eeprom_checksum_generic()
2243 if (hw->eeprom.ops.read(hw, pointer, &length)) { in ixgbe_calc_eeprom_checksum_generic()
2252 if (hw->eeprom.ops.read(hw, j, &word)) { in ixgbe_calc_eeprom_checksum_generic()
2267 * @hw: pointer to hardware structure
2273 s32 ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw, in ixgbe_validate_eeprom_checksum_generic() argument
2286 status = hw->eeprom.ops.read(hw, 0, &checksum); in ixgbe_validate_eeprom_checksum_generic()
2292 status = hw->eeprom.ops.calc_checksum(hw); in ixgbe_validate_eeprom_checksum_generic()
2298 status = hw->eeprom.ops.read(hw, IXGBE_EEPROM_CHECKSUM, &read_checksum); in ixgbe_validate_eeprom_checksum_generic()
2319 * @hw: pointer to hardware structure
2321 s32 ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw) in ixgbe_update_eeprom_checksum_generic() argument
2332 status = hw->eeprom.ops.read(hw, 0, &checksum); in ixgbe_update_eeprom_checksum_generic()
2338 status = hw->eeprom.ops.calc_checksum(hw); in ixgbe_update_eeprom_checksum_generic()
2344 status = hw->eeprom.ops.write(hw, IXGBE_EEPROM_CHECKSUM, checksum); in ixgbe_update_eeprom_checksum_generic()
2377 * @hw: pointer to hardware structure
2385 s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq, in ixgbe_set_rar_generic() argument
2389 u32 rar_entries = hw->mac.num_rar_entries; in ixgbe_set_rar_generic()
2401 hw->mac.ops.set_vmdq(hw, index, vmdq); in ixgbe_set_rar_generic()
2404 * HW expects these in little endian so we reverse the byte in ixgbe_set_rar_generic()
2416 rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(index)); in ixgbe_set_rar_generic()
2423 IXGBE_WRITE_REG(hw, IXGBE_RAL(index), rar_low); in ixgbe_set_rar_generic()
2424 IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high); in ixgbe_set_rar_generic()
2431 * @hw: pointer to hardware structure
2436 s32 ixgbe_clear_rar_generic(struct ixgbe_hw *hw, u32 index) in ixgbe_clear_rar_generic() argument
2439 u32 rar_entries = hw->mac.num_rar_entries; in ixgbe_clear_rar_generic()
2455 rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(index)); in ixgbe_clear_rar_generic()
2458 IXGBE_WRITE_REG(hw, IXGBE_RAL(index), 0); in ixgbe_clear_rar_generic()
2459 IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high); in ixgbe_clear_rar_generic()
2462 hw->mac.ops.clear_vmdq(hw, index, IXGBE_CLEAR_VMDQ_ALL); in ixgbe_clear_rar_generic()
2469 * @hw: pointer to hardware structure
2475 s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw) in ixgbe_init_rx_addrs_generic() argument
2478 u32 rar_entries = hw->mac.num_rar_entries; in ixgbe_init_rx_addrs_generic()
2487 if (ixgbe_validate_mac_addr(hw->mac.addr) == in ixgbe_init_rx_addrs_generic()
2490 hw->mac.ops.get_mac_addr(hw, hw->mac.addr); in ixgbe_init_rx_addrs_generic()
2493 hw->mac.addr[0], hw->mac.addr[1], in ixgbe_init_rx_addrs_generic()
2494 hw->mac.addr[2]); in ixgbe_init_rx_addrs_generic()
2495 DEBUGOUT3("%.2X %.2X %.2X\n", hw->mac.addr[3], in ixgbe_init_rx_addrs_generic()
2496 hw->mac.addr[4], hw->mac.addr[5]); in ixgbe_init_rx_addrs_generic()
2501 hw->mac.addr[0], hw->mac.addr[1], in ixgbe_init_rx_addrs_generic()
2502 hw->mac.addr[2]); in ixgbe_init_rx_addrs_generic()
2503 DEBUGOUT3("%.2X %.2X %.2X\n", hw->mac.addr[3], in ixgbe_init_rx_addrs_generic()
2504 hw->mac.addr[4], hw->mac.addr[5]); in ixgbe_init_rx_addrs_generic()
2506 hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); in ixgbe_init_rx_addrs_generic()
2510 hw->mac.ops.clear_vmdq(hw, 0, IXGBE_CLEAR_VMDQ_ALL); in ixgbe_init_rx_addrs_generic()
2512 hw->addr_ctrl.overflow_promisc = 0; in ixgbe_init_rx_addrs_generic()
2514 hw->addr_ctrl.rar_used_count = 1; in ixgbe_init_rx_addrs_generic()
2519 IXGBE_WRITE_REG(hw, IXGBE_RAL(i), 0); in ixgbe_init_rx_addrs_generic()
2520 IXGBE_WRITE_REG(hw, IXGBE_RAH(i), 0); in ixgbe_init_rx_addrs_generic()
2524 hw->addr_ctrl.mta_in_use = 0; in ixgbe_init_rx_addrs_generic()
2525 IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, hw->mac.mc_filter_type); in ixgbe_init_rx_addrs_generic()
2528 for (i = 0; i < hw->mac.mcft_size; i++) in ixgbe_init_rx_addrs_generic()
2529 IXGBE_WRITE_REG(hw, IXGBE_MTA(i), 0); in ixgbe_init_rx_addrs_generic()
2531 ixgbe_init_uta_tables(hw); in ixgbe_init_rx_addrs_generic()
2538 * @hw: pointer to hardware structure
2544 void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq) in ixgbe_add_uc_addr() argument
2546 u32 rar_entries = hw->mac.num_rar_entries; in ixgbe_add_uc_addr()
2558 if (hw->addr_ctrl.rar_used_count < rar_entries) { in ixgbe_add_uc_addr()
2559 rar = hw->addr_ctrl.rar_used_count; in ixgbe_add_uc_addr()
2560 hw->mac.ops.set_rar(hw, rar, addr, vmdq, IXGBE_RAH_AV); in ixgbe_add_uc_addr()
2562 hw->addr_ctrl.rar_used_count++; in ixgbe_add_uc_addr()
2564 hw->addr_ctrl.overflow_promisc++; in ixgbe_add_uc_addr()
2572 * @hw: pointer to hardware structure
2584 s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list, in ixgbe_update_uc_addr_list_generic() argument
2589 u32 old_promisc_setting = hw->addr_ctrl.overflow_promisc; in ixgbe_update_uc_addr_list_generic()
2600 uc_addr_in_use = hw->addr_ctrl.rar_used_count - 1; in ixgbe_update_uc_addr_list_generic()
2601 hw->addr_ctrl.rar_used_count -= uc_addr_in_use; in ixgbe_update_uc_addr_list_generic()
2602 hw->addr_ctrl.overflow_promisc = 0; in ixgbe_update_uc_addr_list_generic()
2607 IXGBE_WRITE_REG(hw, IXGBE_RAL(1+i), 0); in ixgbe_update_uc_addr_list_generic()
2608 IXGBE_WRITE_REG(hw, IXGBE_RAH(1+i), 0); in ixgbe_update_uc_addr_list_generic()
2614 addr = next(hw, &addr_list, &vmdq); in ixgbe_update_uc_addr_list_generic()
2615 ixgbe_add_uc_addr(hw, addr, vmdq); in ixgbe_update_uc_addr_list_generic()
2618 if (hw->addr_ctrl.overflow_promisc) { in ixgbe_update_uc_addr_list_generic()
2620 if (!old_promisc_setting && !hw->addr_ctrl.user_set_promisc) { in ixgbe_update_uc_addr_list_generic()
2622 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); in ixgbe_update_uc_addr_list_generic()
2624 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); in ixgbe_update_uc_addr_list_generic()
2628 if (old_promisc_setting && !hw->addr_ctrl.user_set_promisc) { in ixgbe_update_uc_addr_list_generic()
2630 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); in ixgbe_update_uc_addr_list_generic()
2632 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); in ixgbe_update_uc_addr_list_generic()
2642 * @hw: pointer to hardware structure
2652 static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr) in ixgbe_mta_vector() argument
2658 switch (hw->mac.mc_filter_type) { in ixgbe_mta_vector()
2684 * @hw: pointer to hardware structure
2689 void ixgbe_set_mta(struct ixgbe_hw *hw, u8 *mc_addr) in ixgbe_set_mta() argument
2697 hw->addr_ctrl.mta_in_use++; in ixgbe_set_mta()
2699 vector = ixgbe_mta_vector(hw, mc_addr); in ixgbe_set_mta()
2713 hw->mac.mta_shadow[vector_reg] |= (1 << vector_bit); in ixgbe_set_mta()
2718 * @hw: pointer to hardware structure
2727 s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list, in ixgbe_update_mc_addr_list_generic() argument
2740 hw->addr_ctrl.num_mc_addrs = mc_addr_count; in ixgbe_update_mc_addr_list_generic()
2741 hw->addr_ctrl.mta_in_use = 0; in ixgbe_update_mc_addr_list_generic()
2746 memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); in ixgbe_update_mc_addr_list_generic()
2752 ixgbe_set_mta(hw, next(hw, &mc_addr_list, &vmdq)); in ixgbe_update_mc_addr_list_generic()
2756 for (i = 0; i < hw->mac.mcft_size; i++) in ixgbe_update_mc_addr_list_generic()
2757 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_MTA(0), i, in ixgbe_update_mc_addr_list_generic()
2758 hw->mac.mta_shadow[i]); in ixgbe_update_mc_addr_list_generic()
2760 if (hw->addr_ctrl.mta_in_use > 0) in ixgbe_update_mc_addr_list_generic()
2761 IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, in ixgbe_update_mc_addr_list_generic()
2762 IXGBE_MCSTCTRL_MFE | hw->mac.mc_filter_type); in ixgbe_update_mc_addr_list_generic()
2770 * @hw: pointer to hardware structure
2774 s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw) in ixgbe_enable_mc_generic() argument
2776 struct ixgbe_addr_filter_info *a = &hw->addr_ctrl; in ixgbe_enable_mc_generic()
2781 IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, IXGBE_MCSTCTRL_MFE | in ixgbe_enable_mc_generic()
2782 hw->mac.mc_filter_type); in ixgbe_enable_mc_generic()
2789 * @hw: pointer to hardware structure
2793 s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw) in ixgbe_disable_mc_generic() argument
2795 struct ixgbe_addr_filter_info *a = &hw->addr_ctrl; in ixgbe_disable_mc_generic()
2800 IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, hw->mac.mc_filter_type); in ixgbe_disable_mc_generic()
2807 * @hw: pointer to hardware structure
2811 s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw) in ixgbe_fc_enable_generic() argument
2822 if (!hw->fc.pause_time) { in ixgbe_fc_enable_generic()
2829 if ((hw->fc.current_mode & ixgbe_fc_tx_pause) && in ixgbe_fc_enable_generic()
2830 hw->fc.high_water[i]) { in ixgbe_fc_enable_generic()
2831 if (!hw->fc.low_water[i] || in ixgbe_fc_enable_generic()
2832 hw->fc.low_water[i] >= hw->fc.high_water[i]) { in ixgbe_fc_enable_generic()
2841 hw->mac.ops.fc_autoneg(hw); in ixgbe_fc_enable_generic()
2844 mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN); in ixgbe_fc_enable_generic()
2847 fccfg_reg = IXGBE_READ_REG(hw, IXGBE_FCCFG); in ixgbe_fc_enable_generic()
2860 switch (hw->fc.current_mode) { in ixgbe_fc_enable_generic()
2864 * The code below will actually disable it in the HW. in ixgbe_fc_enable_generic()
2900 IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn_reg); in ixgbe_fc_enable_generic()
2901 IXGBE_WRITE_REG(hw, IXGBE_FCCFG, fccfg_reg); in ixgbe_fc_enable_generic()
2906 if ((hw->fc.current_mode & ixgbe_fc_tx_pause) && in ixgbe_fc_enable_generic()
2907 hw->fc.high_water[i]) { in ixgbe_fc_enable_generic()
2908 fcrtl = (hw->fc.low_water[i] << 10) | IXGBE_FCRTL_XONE; in ixgbe_fc_enable_generic()
2909 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), fcrtl); in ixgbe_fc_enable_generic()
2910 fcrth = (hw->fc.high_water[i] << 10) | IXGBE_FCRTH_FCEN; in ixgbe_fc_enable_generic()
2912 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), 0); in ixgbe_fc_enable_generic()
2920 fcrth = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(i)) - 24576; in ixgbe_fc_enable_generic()
2923 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), fcrth); in ixgbe_fc_enable_generic()
2927 reg = hw->fc.pause_time * 0x00010001; in ixgbe_fc_enable_generic()
2929 IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg); in ixgbe_fc_enable_generic()
2932 IXGBE_WRITE_REG(hw, IXGBE_FCRTV, hw->fc.pause_time / 2); in ixgbe_fc_enable_generic()
2940 * @hw: pointer to hardware structure
2951 s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg, in ixgbe_negotiate_fc() argument
2970 if (hw->fc.requested_mode == ixgbe_fc_full) { in ixgbe_negotiate_fc()
2971 hw->fc.current_mode = ixgbe_fc_full; in ixgbe_negotiate_fc()
2974 hw->fc.current_mode = ixgbe_fc_rx_pause; in ixgbe_negotiate_fc()
2979 hw->fc.current_mode = ixgbe_fc_tx_pause; in ixgbe_negotiate_fc()
2983 hw->fc.current_mode = ixgbe_fc_rx_pause; in ixgbe_negotiate_fc()
2986 hw->fc.current_mode = ixgbe_fc_none; in ixgbe_negotiate_fc()
2994 * @hw: pointer to hardware structure
2998 static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw) in ixgbe_fc_autoneg_fiber() argument
3009 linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); in ixgbe_fc_autoneg_fiber()
3016 pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); in ixgbe_fc_autoneg_fiber()
3017 pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); in ixgbe_fc_autoneg_fiber()
3019 ret_val = ixgbe_negotiate_fc(hw, pcs_anadv_reg, in ixgbe_fc_autoneg_fiber()
3031 * @hw: pointer to hardware structure
3035 static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw) in ixgbe_fc_autoneg_backplane() argument
3045 links = IXGBE_READ_REG(hw, IXGBE_LINKS); in ixgbe_fc_autoneg_backplane()
3051 if (hw->mac.type == ixgbe_mac_82599EB) { in ixgbe_fc_autoneg_backplane()
3052 links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2); in ixgbe_fc_autoneg_backplane()
3062 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); in ixgbe_fc_autoneg_backplane()
3063 anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1); in ixgbe_fc_autoneg_backplane()
3065 ret_val = ixgbe_negotiate_fc(hw, autoc_reg, in ixgbe_fc_autoneg_backplane()
3075 * @hw: pointer to hardware structure
3079 static s32 ixgbe_fc_autoneg_copper(struct ixgbe_hw *hw) in ixgbe_fc_autoneg_copper() argument
3084 hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_ADVT, in ixgbe_fc_autoneg_copper()
3087 hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_LP, in ixgbe_fc_autoneg_copper()
3091 return ixgbe_negotiate_fc(hw, (u32)technology_ability_reg, in ixgbe_fc_autoneg_copper()
3099 * @hw: pointer to hardware structure
3104 void ixgbe_fc_autoneg(struct ixgbe_hw *hw) in ixgbe_fc_autoneg() argument
3118 if (hw->fc.disable_fc_autoneg) { in ixgbe_fc_autoneg()
3125 hw->mac.ops.check_link(hw, &speed, &link_up, false); in ixgbe_fc_autoneg()
3131 switch (hw->phy.media_type) { in ixgbe_fc_autoneg()
3137 ret_val = ixgbe_fc_autoneg_fiber(hw); in ixgbe_fc_autoneg()
3142 ret_val = ixgbe_fc_autoneg_backplane(hw); in ixgbe_fc_autoneg()
3147 if (ixgbe_device_supports_autoneg_fc(hw)) in ixgbe_fc_autoneg()
3148 ret_val = ixgbe_fc_autoneg_copper(hw); in ixgbe_fc_autoneg()
3157 hw->fc.fc_was_autonegged = true; in ixgbe_fc_autoneg()
3159 hw->fc.fc_was_autonegged = false; in ixgbe_fc_autoneg()
3160 hw->fc.current_mode = hw->fc.requested_mode; in ixgbe_fc_autoneg()
3166 * @hw: pointer to hardware structure
3174 static u32 ixgbe_pcie_timeout_poll(struct ixgbe_hw *hw) in ixgbe_pcie_timeout_poll() argument
3179 devctl2 = IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_DEVICE_CONTROL2); in ixgbe_pcie_timeout_poll()
3213 * @hw: pointer to hardware structure
3220 s32 ixgbe_disable_pcie_primary(struct ixgbe_hw *hw) in ixgbe_disable_pcie_primary() argument
3229 IXGBE_WRITE_REG(hw, IXGBE_CTRL, IXGBE_CTRL_GIO_DIS); in ixgbe_disable_pcie_primary()
3232 if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO) || in ixgbe_disable_pcie_primary()
3233 IXGBE_REMOVED(hw->hw_addr)) in ixgbe_disable_pcie_primary()
3239 if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO)) in ixgbe_disable_pcie_primary()
3252 hw->mac.flags |= IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; in ixgbe_disable_pcie_primary()
3254 if (hw->mac.type >= ixgbe_mac_X550) in ixgbe_disable_pcie_primary()
3261 poll = ixgbe_pcie_timeout_poll(hw); in ixgbe_disable_pcie_primary()
3264 value = IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_DEVICE_STATUS); in ixgbe_disable_pcie_primary()
3265 if (IXGBE_REMOVED(hw->hw_addr)) in ixgbe_disable_pcie_primary()
3281 * @hw: pointer to hardware structure
3287 s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u32 mask) in ixgbe_acquire_swfw_sync() argument
3302 if (ixgbe_get_eeprom_semaphore(hw)) in ixgbe_acquire_swfw_sync()
3305 gssr = IXGBE_READ_REG(hw, IXGBE_GSSR); in ixgbe_acquire_swfw_sync()
3308 IXGBE_WRITE_REG(hw, IXGBE_GSSR, gssr); in ixgbe_acquire_swfw_sync()
3309 ixgbe_release_eeprom_semaphore(hw); in ixgbe_acquire_swfw_sync()
3313 ixgbe_release_eeprom_semaphore(hw); in ixgbe_acquire_swfw_sync()
3320 ixgbe_release_swfw_sync(hw, gssr & (fwmask | swmask)); in ixgbe_acquire_swfw_sync()
3328 * @hw: pointer to hardware structure
3334 void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u32 mask) in ixgbe_release_swfw_sync() argument
3341 ixgbe_get_eeprom_semaphore(hw); in ixgbe_release_swfw_sync()
3343 gssr = IXGBE_READ_REG(hw, IXGBE_GSSR); in ixgbe_release_swfw_sync()
3345 IXGBE_WRITE_REG(hw, IXGBE_GSSR, gssr); in ixgbe_release_swfw_sync()
3347 ixgbe_release_eeprom_semaphore(hw); in ixgbe_release_swfw_sync()
3352 * @hw: pointer to hardware structure
3354 * Stops the receive data path and waits for the HW to internally empty
3357 s32 ixgbe_disable_sec_rx_path_generic(struct ixgbe_hw *hw) in ixgbe_disable_sec_rx_path_generic() argument
3367 secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); in ixgbe_disable_sec_rx_path_generic()
3369 IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg); in ixgbe_disable_sec_rx_path_generic()
3371 secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT); in ixgbe_disable_sec_rx_path_generic()
3389 * @hw: pointer to hardware structure
3395 s32 prot_autoc_read_generic(struct ixgbe_hw *hw, bool *locked, u32 *reg_val) in prot_autoc_read_generic() argument
3398 *reg_val = IXGBE_READ_REG(hw, IXGBE_AUTOC); in prot_autoc_read_generic()
3404 * @hw: pointer to hardware structure
3411 s32 prot_autoc_write_generic(struct ixgbe_hw *hw, u32 reg_val, bool locked) in prot_autoc_write_generic() argument
3415 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_val); in prot_autoc_write_generic()
3421 * @hw: pointer to hardware structure
3425 s32 ixgbe_enable_sec_rx_path_generic(struct ixgbe_hw *hw) in ixgbe_enable_sec_rx_path_generic() argument
3431 secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); in ixgbe_enable_sec_rx_path_generic()
3433 IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg); in ixgbe_enable_sec_rx_path_generic()
3434 IXGBE_WRITE_FLUSH(hw); in ixgbe_enable_sec_rx_path_generic()
3441 * @hw: pointer to hardware structure
3446 s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval) in ixgbe_enable_rx_dma_generic() argument
3451 ixgbe_enable_rx(hw); in ixgbe_enable_rx_dma_generic()
3453 ixgbe_disable_rx(hw); in ixgbe_enable_rx_dma_generic()
3460 * @hw: pointer to hardware structure
3463 s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index) in ixgbe_blink_led_start_generic() argument
3468 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_blink_led_start_generic()
3481 hw->mac.ops.check_link(hw, &speed, &link_up, false); in ixgbe_blink_led_start_generic()
3484 ret_val = hw->mac.ops.prot_autoc_read(hw, &locked, &autoc_reg); in ixgbe_blink_led_start_generic()
3491 ret_val = hw->mac.ops.prot_autoc_write(hw, autoc_reg, locked); in ixgbe_blink_led_start_generic()
3495 IXGBE_WRITE_FLUSH(hw); in ixgbe_blink_led_start_generic()
3501 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); in ixgbe_blink_led_start_generic()
3502 IXGBE_WRITE_FLUSH(hw); in ixgbe_blink_led_start_generic()
3510 * @hw: pointer to hardware structure
3513 s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index) in ixgbe_blink_led_stop_generic() argument
3516 u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_blink_led_stop_generic()
3525 ret_val = hw->mac.ops.prot_autoc_read(hw, &locked, &autoc_reg); in ixgbe_blink_led_stop_generic()
3532 ret_val = hw->mac.ops.prot_autoc_write(hw, autoc_reg, locked); in ixgbe_blink_led_stop_generic()
3539 IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); in ixgbe_blink_led_stop_generic()
3540 IXGBE_WRITE_FLUSH(hw); in ixgbe_blink_led_stop_generic()
3548 * @hw: pointer to hardware structure
3555 static s32 ixgbe_get_san_mac_addr_offset(struct ixgbe_hw *hw, in ixgbe_get_san_mac_addr_offset() argument
3566 ret_val = hw->eeprom.ops.read(hw, IXGBE_SAN_MAC_ADDR_PTR, in ixgbe_get_san_mac_addr_offset()
3579 * @hw: pointer to hardware structure
3587 s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr) in ixgbe_get_san_mac_addr_generic() argument
3599 ret_val = ixgbe_get_san_mac_addr_offset(hw, &san_mac_offset); in ixgbe_get_san_mac_addr_generic()
3604 hw->mac.ops.set_lan_id(hw); in ixgbe_get_san_mac_addr_generic()
3606 (hw->bus.func) ? (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT1_OFFSET) : in ixgbe_get_san_mac_addr_generic()
3609 ret_val = hw->eeprom.ops.read(hw, san_mac_offset, in ixgbe_get_san_mac_addr_generic()
3635 * @hw: pointer to hardware structure
3640 s32 ixgbe_set_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr) in ixgbe_set_san_mac_addr_generic() argument
3649 ret_val = ixgbe_get_san_mac_addr_offset(hw, &san_mac_offset); in ixgbe_set_san_mac_addr_generic()
3654 hw->mac.ops.set_lan_id(hw); in ixgbe_set_san_mac_addr_generic()
3656 (hw->bus.func) ? (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT1_OFFSET) : in ixgbe_set_san_mac_addr_generic()
3662 hw->eeprom.ops.write(hw, san_mac_offset, san_mac_data); in ixgbe_set_san_mac_addr_generic()
3671 * @hw: pointer to hardware structure
3676 u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw) in ixgbe_get_pcie_msix_count_generic() argument
3682 switch (hw->mac.type) { in ixgbe_get_pcie_msix_count_generic()
3700 msix_count = IXGBE_READ_PCIE_WORD(hw, pcie_offset); in ixgbe_get_pcie_msix_count_generic()
3701 if (IXGBE_REMOVED(hw->hw_addr)) in ixgbe_get_pcie_msix_count_generic()
3705 /* MSI-X count is zero-based in HW */ in ixgbe_get_pcie_msix_count_generic()
3716 * @hw: pointer to hardware structure
3723 s32 ixgbe_insert_mac_addr_generic(struct ixgbe_hw *hw, u8 *addr, u32 vmdq) in ixgbe_insert_mac_addr_generic() argument
3733 /* swap bytes for HW little endian */ in ixgbe_insert_mac_addr_generic()
3745 for (rar = 0; rar < hw->mac.rar_highwater; rar++) { in ixgbe_insert_mac_addr_generic()
3746 rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar)); in ixgbe_insert_mac_addr_generic()
3752 rar_low = IXGBE_READ_REG(hw, IXGBE_RAL(rar)); in ixgbe_insert_mac_addr_generic()
3758 if (rar < hw->mac.rar_highwater) { in ixgbe_insert_mac_addr_generic()
3760 ixgbe_set_vmdq(hw, rar, vmdq); in ixgbe_insert_mac_addr_generic()
3764 ixgbe_set_rar(hw, rar, addr, vmdq, IXGBE_RAH_AV); in ixgbe_insert_mac_addr_generic()
3765 } else if (rar == hw->mac.rar_highwater) { in ixgbe_insert_mac_addr_generic()
3767 ixgbe_set_rar(hw, rar, addr, vmdq, IXGBE_RAH_AV); in ixgbe_insert_mac_addr_generic()
3768 hw->mac.rar_highwater++; in ixgbe_insert_mac_addr_generic()
3769 } else if (rar >= hw->mac.num_rar_entries) { in ixgbe_insert_mac_addr_generic()
3778 ixgbe_clear_vmdq(hw, rar, 0); in ixgbe_insert_mac_addr_generic()
3785 * @hw: pointer to hardware struct
3789 s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq) in ixgbe_clear_vmdq_generic() argument
3792 u32 rar_entries = hw->mac.num_rar_entries; in ixgbe_clear_vmdq_generic()
3803 mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); in ixgbe_clear_vmdq_generic()
3804 mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); in ixgbe_clear_vmdq_generic()
3806 if (IXGBE_REMOVED(hw->hw_addr)) in ixgbe_clear_vmdq_generic()
3814 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0); in ixgbe_clear_vmdq_generic()
3815 mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); in ixgbe_clear_vmdq_generic()
3818 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0); in ixgbe_clear_vmdq_generic()
3819 mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); in ixgbe_clear_vmdq_generic()
3823 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar_lo); in ixgbe_clear_vmdq_generic()
3826 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar_hi); in ixgbe_clear_vmdq_generic()
3831 rar != 0 && rar != hw->mac.san_mac_rar_index) in ixgbe_clear_vmdq_generic()
3832 hw->mac.ops.clear_rar(hw, rar); in ixgbe_clear_vmdq_generic()
3839 * @hw: pointer to hardware struct
3843 s32 ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq) in ixgbe_set_vmdq_generic() argument
3846 u32 rar_entries = hw->mac.num_rar_entries; in ixgbe_set_vmdq_generic()
3858 mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); in ixgbe_set_vmdq_generic()
3860 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar); in ixgbe_set_vmdq_generic()
3862 mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); in ixgbe_set_vmdq_generic()
3864 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar); in ixgbe_set_vmdq_generic()
3872 * @hw: pointer to hardware struct
3878 * MPSAR table needs to be updated for SAN_MAC RAR [hw->mac.san_mac_rar_index]
3880 s32 ixgbe_set_vmdq_san_mac_generic(struct ixgbe_hw *hw, u32 vmdq) in ixgbe_set_vmdq_san_mac_generic() argument
3882 u32 rar = hw->mac.san_mac_rar_index; in ixgbe_set_vmdq_san_mac_generic()
3887 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 1 << vmdq); in ixgbe_set_vmdq_san_mac_generic()
3888 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0); in ixgbe_set_vmdq_san_mac_generic()
3890 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0); in ixgbe_set_vmdq_san_mac_generic()
3891 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 1 << (vmdq - 32)); in ixgbe_set_vmdq_san_mac_generic()
3899 * @hw: pointer to hardware structure
3901 s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw) in ixgbe_init_uta_tables_generic() argument
3909 IXGBE_WRITE_REG(hw, IXGBE_UTA(i), 0); in ixgbe_init_uta_tables_generic()
3916 * @hw: pointer to hardware structure
3925 s32 ixgbe_find_vlvf_slot(struct ixgbe_hw *hw, u32 vlan, bool vlvf_bypass) in ixgbe_find_vlvf_slot() argument
3949 bits = IXGBE_READ_REG(hw, IXGBE_VLVF(regindex)); in ixgbe_find_vlvf_slot()
3967 * @hw: pointer to hardware structure
3975 s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind, in ixgbe_set_vfta_generic() argument
4000 vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(regidx)); in ixgbe_set_vfta_generic()
4013 ret_val = ixgbe_set_vlvf_generic(hw, vlan, vind, vlan_on, &vfta_delta, in ixgbe_set_vfta_generic()
4024 IXGBE_WRITE_REG(hw, IXGBE_VFTA(regidx), vfta); in ixgbe_set_vfta_generic()
4031 * @hw: pointer to hardware structure
4042 s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind, in ixgbe_set_vlvf_generic() argument
4061 if (!(IXGBE_READ_REG(hw, IXGBE_VT_CTL) & IXGBE_VT_CTL_VT_ENABLE)) in ixgbe_set_vlvf_generic()
4064 vlvf_index = ixgbe_find_vlvf_slot(hw, vlan, vlvf_bypass); in ixgbe_set_vlvf_generic()
4068 bits = IXGBE_READ_REG(hw, IXGBE_VLVFB(vlvf_index * 2 + vind / 32)); in ixgbe_set_vlvf_generic()
4079 !IXGBE_READ_REG(hw, IXGBE_VLVFB(vlvf_index * 2 + 1 - vind / 32))) { in ixgbe_set_vlvf_generic()
4085 IXGBE_WRITE_REG(hw, IXGBE_VFTA(vlan / 32), vfta); in ixgbe_set_vlvf_generic()
4088 IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index), 0); in ixgbe_set_vlvf_generic()
4089 IXGBE_WRITE_REG(hw, IXGBE_VLVFB(vlvf_index * 2 + vind / 32), 0); in ixgbe_set_vlvf_generic()
4112 IXGBE_WRITE_REG(hw, IXGBE_VLVFB(vlvf_index * 2 + vind / 32), bits); in ixgbe_set_vlvf_generic()
4113 IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index), IXGBE_VLVF_VIEN | vlan); in ixgbe_set_vlvf_generic()
4120 * @hw: pointer to hardware structure
4124 s32 ixgbe_clear_vfta_generic(struct ixgbe_hw *hw) in ixgbe_clear_vfta_generic() argument
4130 for (offset = 0; offset < hw->mac.vft_size; offset++) in ixgbe_clear_vfta_generic()
4131 IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0); in ixgbe_clear_vfta_generic()
4134 IXGBE_WRITE_REG(hw, IXGBE_VLVF(offset), 0); in ixgbe_clear_vfta_generic()
4135 IXGBE_WRITE_REG(hw, IXGBE_VLVFB(offset * 2), 0); in ixgbe_clear_vfta_generic()
4136 IXGBE_WRITE_REG(hw, IXGBE_VLVFB(offset * 2 + 1), 0); in ixgbe_clear_vfta_generic()
4145 * @hw: pointer to hardware structure
4150 s32 ixgbe_toggle_txdctl_generic(struct ixgbe_hw *hw, u32 vf_number) in ixgbe_toggle_txdctl_generic() argument
4162 reg = IXGBE_READ_REG(hw, IXGBE_GCR_EXT); in ixgbe_toggle_txdctl_generic()
4183 reg = IXGBE_READ_REG(hw, IXGBE_PVFTXDCTL(offset)); in ixgbe_toggle_txdctl_generic()
4185 IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(offset), reg); in ixgbe_toggle_txdctl_generic()
4186 IXGBE_WRITE_FLUSH(hw); in ixgbe_toggle_txdctl_generic()
4189 reg = IXGBE_READ_REG(hw, IXGBE_PVFTXDCTL(offset)); in ixgbe_toggle_txdctl_generic()
4191 IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(offset), reg); in ixgbe_toggle_txdctl_generic()
4192 IXGBE_WRITE_FLUSH(hw); in ixgbe_toggle_txdctl_generic()
4200 * @hw: pointer to hardware structure
4205 static bool ixgbe_need_crosstalk_fix(struct ixgbe_hw *hw) in ixgbe_need_crosstalk_fix() argument
4209 if (!hw->need_crosstalk_fix) in ixgbe_need_crosstalk_fix()
4213 switch (hw->mac.ops.get_media_type(hw)) { in ixgbe_need_crosstalk_fix()
4226 * @hw: pointer to hardware structure
4233 s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed, in ixgbe_check_mac_link_generic() argument
4244 if (ixgbe_need_crosstalk_fix(hw)) { in ixgbe_check_mac_link_generic()
4247 switch (hw->mac.type) { in ixgbe_check_mac_link_generic()
4249 sfp_cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) & in ixgbe_check_mac_link_generic()
4254 sfp_cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) & in ixgbe_check_mac_link_generic()
4271 links_orig = IXGBE_READ_REG(hw, IXGBE_LINKS); in ixgbe_check_mac_link_generic()
4273 links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); in ixgbe_check_mac_link_generic()
4281 for (i = 0; i < hw->mac.max_link_up_time; i++) { in ixgbe_check_mac_link_generic()
4289 links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); in ixgbe_check_mac_link_generic()
4293 if (ixgbe_need_crosstalk_fix(hw)) { in ixgbe_check_mac_link_generic()
4299 links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); in ixgbe_check_mac_link_generic()
4316 if (hw->mac.type >= ixgbe_mac_X550) { in ixgbe_check_mac_link_generic()
4326 if (hw->mac.type == ixgbe_mac_X550) { in ixgbe_check_mac_link_generic()
4333 if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T || in ixgbe_check_mac_link_generic()
4334 hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) in ixgbe_check_mac_link_generic()
4347 * @hw: pointer to hardware structure
4354 s32 ixgbe_get_wwn_prefix_generic(struct ixgbe_hw *hw, u16 *wwnn_prefix, in ixgbe_get_wwn_prefix_generic() argument
4368 if (hw->eeprom.ops.read(hw, offset, &alt_san_mac_blk_offset)) in ixgbe_get_wwn_prefix_generic()
4377 if (hw->eeprom.ops.read(hw, offset, &caps)) in ixgbe_get_wwn_prefix_generic()
4384 if (hw->eeprom.ops.read(hw, offset, wwnn_prefix)) { in ixgbe_get_wwn_prefix_generic()
4390 if (hw->eeprom.ops.read(hw, offset, wwpn_prefix)) in ixgbe_get_wwn_prefix_generic()
4404 * @hw: pointer to hardware structure
4409 s32 ixgbe_get_fcoe_boot_status_generic(struct ixgbe_hw *hw, u16 *bs) in ixgbe_get_fcoe_boot_status_generic() argument
4421 status = hw->eeprom.ops.read(hw, offset, &caps); in ixgbe_get_fcoe_boot_status_generic()
4429 status = hw->eeprom.ops.read(hw, IXGBE_ISCSI_FCOE_BLK_PTR, &offset); in ixgbe_get_fcoe_boot_status_generic()
4438 status = hw->eeprom.ops.read(hw, offset, &flags); in ixgbe_get_fcoe_boot_status_generic()
4453 * @hw: pointer to hardware structure
4458 void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf) in ixgbe_set_mac_anti_spoofing() argument
4464 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_set_mac_anti_spoofing()
4467 pfvfspoof = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg)); in ixgbe_set_mac_anti_spoofing()
4472 IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg), pfvfspoof); in ixgbe_set_mac_anti_spoofing()
4477 * @hw: pointer to hardware structure
4482 void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf) in ixgbe_set_vlan_anti_spoofing() argument
4488 if (hw->mac.type == ixgbe_mac_82598EB) in ixgbe_set_vlan_anti_spoofing()
4491 pfvfspoof = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg)); in ixgbe_set_vlan_anti_spoofing()
4496 IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg), pfvfspoof); in ixgbe_set_vlan_anti_spoofing()
4501 * @hw: pointer to hardware structure
4507 s32 ixgbe_get_device_caps_generic(struct ixgbe_hw *hw, u16 *device_caps) in ixgbe_get_device_caps_generic() argument
4511 hw->eeprom.ops.read(hw, IXGBE_DEVICE_CAPS, device_caps); in ixgbe_get_device_caps_generic()
4518 * @hw: pointer to hardware structure
4521 void ixgbe_enable_relaxed_ordering_gen2(struct ixgbe_hw *hw) in ixgbe_enable_relaxed_ordering_gen2() argument
4529 for (i = 0; i < hw->mac.max_tx_queues; i++) { in ixgbe_enable_relaxed_ordering_gen2()
4530 regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(i)); in ixgbe_enable_relaxed_ordering_gen2()
4532 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(i), regval); in ixgbe_enable_relaxed_ordering_gen2()
4535 for (i = 0; i < hw->mac.max_rx_queues; i++) { in ixgbe_enable_relaxed_ordering_gen2()
4536 regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i)); in ixgbe_enable_relaxed_ordering_gen2()
4539 IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval); in ixgbe_enable_relaxed_ordering_gen2()
4569 * @hw: pointer to the HW structure
4581 s32 ixgbe_hic_unlocked(struct ixgbe_hw *hw, u32 *buffer, u32 length, in ixgbe_hic_unlocked() argument
4595 fwsts = IXGBE_READ_REG(hw, IXGBE_FWSTS); in ixgbe_hic_unlocked()
4596 IXGBE_WRITE_REG(hw, IXGBE_FWSTS, fwsts | IXGBE_FWSTS_FWRI); in ixgbe_hic_unlocked()
4599 hicr = IXGBE_READ_REG(hw, IXGBE_HICR); in ixgbe_hic_unlocked()
4617 IXGBE_WRITE_REG_ARRAY(hw, IXGBE_FLEX_MNG, in ixgbe_hic_unlocked()
4621 IXGBE_WRITE_REG(hw, IXGBE_HICR, hicr | IXGBE_HICR_C); in ixgbe_hic_unlocked()
4624 hicr = IXGBE_READ_REG(hw, IXGBE_HICR); in ixgbe_hic_unlocked()
4639 !(IXGBE_READ_REG(hw, IXGBE_HICR) & IXGBE_HICR_SV)) { in ixgbe_hic_unlocked()
4650 * @hw: pointer to the HW structure
4666 s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer, in ixgbe_host_interface_command() argument
4684 status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM); in ixgbe_host_interface_command()
4688 status = ixgbe_hic_unlocked(hw, buffer, length, timeout); in ixgbe_host_interface_command()
4700 buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi); in ixgbe_host_interface_command()
4712 buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, in ixgbe_host_interface_command()
4736 buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi); in ixgbe_host_interface_command()
4741 hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM); in ixgbe_host_interface_command()
4748 * @hw: pointer to the HW structure
4761 s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min, in ixgbe_set_fw_drv_ver_generic() argument
4775 fw_cmd.port_num = (u8)hw->bus.func; in ixgbe_set_fw_drv_ver_generic()
4787 ret_val = ixgbe_host_interface_command(hw, (u32 *)&fw_cmd, in ixgbe_set_fw_drv_ver_generic()
4808 * @hw: pointer to hardware structure
4813 void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, int num_pb, u32 headroom, in ixgbe_set_rxpba_generic() argument
4816 u32 pbsize = hw->mac.rx_pb_size; in ixgbe_set_rxpba_generic()
4838 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize); in ixgbe_set_rxpba_generic()
4841 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize); in ixgbe_set_rxpba_generic()
4846 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize); in ixgbe_set_rxpba_generic()
4856 IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), txpktsize); in ixgbe_set_rxpba_generic()
4857 IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i), txpbthresh); in ixgbe_set_rxpba_generic()
4862 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), 0); in ixgbe_set_rxpba_generic()
4863 IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), 0); in ixgbe_set_rxpba_generic()
4864 IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i), 0); in ixgbe_set_rxpba_generic()
4870 * @hw: pointer to the hardware structure
4876 void ixgbe_clear_tx_pending(struct ixgbe_hw *hw) in ixgbe_clear_tx_pending() argument
4885 if (!(hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED)) in ixgbe_clear_tx_pending()
4893 hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0); in ixgbe_clear_tx_pending()
4894 IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0 | IXGBE_HLREG0_LPBK); in ixgbe_clear_tx_pending()
4897 IXGBE_WRITE_FLUSH(hw); in ixgbe_clear_tx_pending()
4904 poll = ixgbe_pcie_timeout_poll(hw); in ixgbe_clear_tx_pending()
4907 value = IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_DEVICE_STATUS); in ixgbe_clear_tx_pending()
4908 if (IXGBE_REMOVED(hw->hw_addr)) in ixgbe_clear_tx_pending()
4916 gcr_ext = IXGBE_READ_REG(hw, IXGBE_GCR_EXT); in ixgbe_clear_tx_pending()
4917 IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, in ixgbe_clear_tx_pending()
4921 IXGBE_WRITE_FLUSH(hw); in ixgbe_clear_tx_pending()
4925 IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext); in ixgbe_clear_tx_pending()
4926 IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0); in ixgbe_clear_tx_pending()
4944 * @hw: pointer to hardware structure
4948 s32 ixgbe_get_thermal_sensor_data_generic(struct ixgbe_hw *hw) in ixgbe_get_thermal_sensor_data_generic() argument
4958 struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; in ixgbe_get_thermal_sensor_data_generic()
4963 if ((hw->mac.type != ixgbe_mac_82599EB) || in ixgbe_get_thermal_sensor_data_generic()
4964 (IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)) { in ixgbe_get_thermal_sensor_data_generic()
4969 status = hw->eeprom.ops.read(hw, IXGBE_ETS_CFG, &ets_offset); in ixgbe_get_thermal_sensor_data_generic()
4978 status = hw->eeprom.ops.read(hw, ets_offset, &ets_cfg); in ixgbe_get_thermal_sensor_data_generic()
4993 status = hw->eeprom.ops.read(hw, (ets_offset + 1 + i), in ixgbe_get_thermal_sensor_data_generic()
5004 status = hw->phy.ops.read_i2c_byte(hw, in ixgbe_get_thermal_sensor_data_generic()
5018 * @hw: pointer to hardware structure
5023 s32 ixgbe_init_thermal_sensor_thresh_generic(struct ixgbe_hw *hw) in ixgbe_init_thermal_sensor_thresh_generic() argument
5036 struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; in ixgbe_init_thermal_sensor_thresh_generic()
5043 if ((hw->mac.type != ixgbe_mac_82599EB) || in ixgbe_init_thermal_sensor_thresh_generic()
5044 (IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)) in ixgbe_init_thermal_sensor_thresh_generic()
5048 if (hw->eeprom.ops.read(hw, offset, &ets_offset)) in ixgbe_init_thermal_sensor_thresh_generic()
5054 if (hw->eeprom.ops.read(hw, offset, &ets_cfg)) in ixgbe_init_thermal_sensor_thresh_generic()
5066 if (hw->eeprom.ops.read(hw, offset, &ets_sensor)) { in ixgbe_init_thermal_sensor_thresh_generic()
5078 hw->phy.ops.write_i2c_byte(hw, in ixgbe_init_thermal_sensor_thresh_generic()
5100 * @hw: pointer to hardware structure
5107 s32 ixgbe_bypass_rw_generic(struct ixgbe_hw *hw, u32 cmd, u32 *status) in ixgbe_bypass_rw_generic() argument
5119 switch (hw->mac.type) { in ixgbe_bypass_rw_generic()
5141 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_bypass_rw_generic()
5147 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_bypass_rw_generic()
5148 IXGBE_WRITE_FLUSH(hw); in ixgbe_bypass_rw_generic()
5153 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_bypass_rw_generic()
5154 IXGBE_WRITE_FLUSH(hw); in ixgbe_bypass_rw_generic()
5158 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_bypass_rw_generic()
5159 IXGBE_WRITE_FLUSH(hw); in ixgbe_bypass_rw_generic()
5166 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_bypass_rw_generic()
5169 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_bypass_rw_generic()
5171 IXGBE_WRITE_FLUSH(hw); in ixgbe_bypass_rw_generic()
5175 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_bypass_rw_generic()
5176 IXGBE_WRITE_FLUSH(hw); in ixgbe_bypass_rw_generic()
5180 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_bypass_rw_generic()
5181 IXGBE_WRITE_FLUSH(hw); in ixgbe_bypass_rw_generic()
5184 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); in ixgbe_bypass_rw_generic()
5195 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_bypass_rw_generic()
5196 IXGBE_WRITE_FLUSH(hw); in ixgbe_bypass_rw_generic()
5200 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp); in ixgbe_bypass_rw_generic()
5201 IXGBE_WRITE_FLUSH(hw); in ixgbe_bypass_rw_generic()
5268 * @hw: pointer to hardware structure
5276 s32 ixgbe_bypass_set_generic(struct ixgbe_hw *hw, u32 ctrl, u32 event, in ixgbe_bypass_set_generic() argument
5285 if (ixgbe_bypass_rw_generic(hw, cmd, &by_ctl)) in ixgbe_bypass_set_generic()
5290 if (ixgbe_bypass_rw_generic(hw, cmd, &by_ctl)) in ixgbe_bypass_set_generic()
5300 if (ixgbe_bypass_rw_generic(hw, verify, &by_ctl)) in ixgbe_bypass_set_generic()
5314 * @hw: pointer to hardware structure
5318 s32 ixgbe_bypass_rd_eep_generic(struct ixgbe_hw *hw, u32 addr, u8 *value) in ixgbe_bypass_rd_eep_generic() argument
5327 if (ixgbe_bypass_rw_generic(hw, cmd, &status)) in ixgbe_bypass_rd_eep_generic()
5335 if (ixgbe_bypass_rw_generic(hw, cmd, &status)) in ixgbe_bypass_rd_eep_generic()
5346 * @hw: pointer to hardware structure
5352 void ixgbe_get_orom_version(struct ixgbe_hw *hw, in ixgbe_get_orom_version() argument
5359 hw->eeprom.ops.read(hw, NVM_OROM_OFFSET, &offset); in ixgbe_get_orom_version()
5365 hw->eeprom.ops.read(hw, offset + NVM_OROM_BLK_HI, &eeprom_cfg_blkh); in ixgbe_get_orom_version()
5366 hw->eeprom.ops.read(hw, offset + NVM_OROM_BLK_LOW, &eeprom_cfg_blkl); in ixgbe_get_orom_version()
5384 * @hw: pointer to hardware structure
5390 void ixgbe_get_oem_prod_version(struct ixgbe_hw *hw, in ixgbe_get_oem_prod_version() argument
5396 hw->eeprom.ops.read(hw, NVM_OEM_PROD_VER_PTR, &offset); in ixgbe_get_oem_prod_version()
5403 hw->eeprom.ops.read(hw, offset, &mod_len); in ixgbe_get_oem_prod_version()
5404 hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_CAP_OFF, &cap); in ixgbe_get_oem_prod_version()
5411 hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_OFF_L, &prod_ver); in ixgbe_get_oem_prod_version()
5412 hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_OFF_H, &rel_num); in ixgbe_get_oem_prod_version()
5428 * @hw: pointer to hardware structure
5433 void ixgbe_get_etk_id(struct ixgbe_hw *hw, struct ixgbe_nvm_version *nvm_ver) in ixgbe_get_etk_id() argument
5437 if (hw->eeprom.ops.read(hw, NVM_ETK_OFF_LOW, &etk_id_l)) in ixgbe_get_etk_id()
5439 if (hw->eeprom.ops.read(hw, NVM_ETK_OFF_HI, &etk_id_h)) in ixgbe_get_etk_id()
5457 * @hw: pointer to hardware structure
5462 void ixgbe_get_nvm_version(struct ixgbe_hw *hw, in ixgbe_get_nvm_version() argument
5472 switch (hw->mac.type) { in ixgbe_get_nvm_version()
5475 if (ixgbe_read_eeprom(hw, NVM_EEP_OFFSET_82598, &word)) in ixgbe_get_nvm_version()
5485 if (ixgbe_read_eeprom(hw, NVM_EEP_OFFSET_X540, &word)) in ixgbe_get_nvm_version()
5498 if (ixgbe_read_eeprom(hw, NVM_EEP_OFFSET_X540, &word)) in ixgbe_get_nvm_version()
5510 switch (hw->mac.type) { in ixgbe_get_nvm_version()
5516 if (ixgbe_read_eeprom(hw, NVM_EEP_PHY_OFF_X540, &word)) in ixgbe_get_nvm_version()
5528 ixgbe_get_etk_id(hw, nvm_ver); in ixgbe_get_nvm_version()
5531 if (ixgbe_read_eeprom(hw, NVM_DS_OFFSET, &word)) in ixgbe_get_nvm_version()
5537 if (ixgbe_read_eeprom(hw, NVM_OEM_OFFSET, &nvm_ver->oem_specific)) in ixgbe_get_nvm_version()
5541 if (ixgbe_get_phy_firmware_version(hw, &phy_ver)) in ixgbe_get_nvm_version()
5548 ixgbe_get_orom_version(hw, nvm_ver); in ixgbe_get_nvm_version()
5554 * @hw: pointer to hardware structure
5557 * Read the rtrup2tc HW register and resolve its content into map
5559 void ixgbe_dcb_get_rtrup2tc_generic(struct ixgbe_hw *hw, u8 *map) in ixgbe_dcb_get_rtrup2tc_generic() argument
5563 reg = IXGBE_READ_REG(hw, IXGBE_RTRUP2TC); in ixgbe_dcb_get_rtrup2tc_generic()
5570 void ixgbe_disable_rx_generic(struct ixgbe_hw *hw) in ixgbe_disable_rx_generic() argument
5575 rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); in ixgbe_disable_rx_generic()
5577 if (hw->mac.type != ixgbe_mac_82598EB) { in ixgbe_disable_rx_generic()
5578 pfdtxgswc = IXGBE_READ_REG(hw, IXGBE_PFDTXGSWC); in ixgbe_disable_rx_generic()
5581 IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, pfdtxgswc); in ixgbe_disable_rx_generic()
5582 hw->mac.set_lben = true; in ixgbe_disable_rx_generic()
5584 hw->mac.set_lben = false; in ixgbe_disable_rx_generic()
5588 IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl); in ixgbe_disable_rx_generic()
5592 void ixgbe_enable_rx_generic(struct ixgbe_hw *hw) in ixgbe_enable_rx_generic() argument
5597 rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); in ixgbe_enable_rx_generic()
5598 IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, (rxctrl | IXGBE_RXCTRL_RXEN)); in ixgbe_enable_rx_generic()
5600 if (hw->mac.type != ixgbe_mac_82598EB) { in ixgbe_enable_rx_generic()
5601 if (hw->mac.set_lben) { in ixgbe_enable_rx_generic()
5602 pfdtxgswc = IXGBE_READ_REG(hw, IXGBE_PFDTXGSWC); in ixgbe_enable_rx_generic()
5604 IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, pfdtxgswc); in ixgbe_enable_rx_generic()
5605 hw->mac.set_lben = false; in ixgbe_enable_rx_generic()
5612 * @hw: pointer to hardware structure
5614 bool ixgbe_mng_present(struct ixgbe_hw *hw) in ixgbe_mng_present() argument
5618 if (hw->mac.type < ixgbe_mac_82599EB) in ixgbe_mng_present()
5621 fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM_BY_MAC(hw)); in ixgbe_mng_present()
5628 * @hw: pointer to hardware structure
5632 bool ixgbe_mng_enabled(struct ixgbe_hw *hw) in ixgbe_mng_enabled() argument
5636 fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM_BY_MAC(hw)); in ixgbe_mng_enabled()
5640 manc = IXGBE_READ_REG(hw, IXGBE_MANC); in ixgbe_mng_enabled()
5644 if (hw->mac.type <= ixgbe_mac_X540) { in ixgbe_mng_enabled()
5645 factps = IXGBE_READ_REG(hw, IXGBE_FACTPS_BY_MAC(hw)); in ixgbe_mng_enabled()
5655 * @hw: pointer to hardware structure
5661 s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, in ixgbe_setup_mac_link_multispeed_fiber() argument
5675 status = ixgbe_get_link_capabilities(hw, &link_speed, &autoneg); in ixgbe_setup_mac_link_multispeed_fiber()
5689 switch (hw->phy.media_type) { in ixgbe_setup_mac_link_multispeed_fiber()
5692 ixgbe_set_rate_select_speed(hw, in ixgbe_setup_mac_link_multispeed_fiber()
5706 status = ixgbe_setup_mac_link(hw, in ixgbe_setup_mac_link_multispeed_fiber()
5713 ixgbe_flap_tx_laser(hw); in ixgbe_setup_mac_link_multispeed_fiber()
5724 status = ixgbe_check_link(hw, &link_speed, in ixgbe_setup_mac_link_multispeed_fiber()
5740 switch (hw->phy.media_type) { in ixgbe_setup_mac_link_multispeed_fiber()
5743 ixgbe_set_rate_select_speed(hw, in ixgbe_setup_mac_link_multispeed_fiber()
5757 status = ixgbe_setup_mac_link(hw, in ixgbe_setup_mac_link_multispeed_fiber()
5764 ixgbe_flap_tx_laser(hw); in ixgbe_setup_mac_link_multispeed_fiber()
5770 status = ixgbe_check_link(hw, &link_speed, &link_up, false); in ixgbe_setup_mac_link_multispeed_fiber()
5783 status = ixgbe_setup_mac_link_multispeed_fiber(hw, in ixgbe_setup_mac_link_multispeed_fiber()
5789 hw->phy.autoneg_advertised = 0; in ixgbe_setup_mac_link_multispeed_fiber()
5792 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL; in ixgbe_setup_mac_link_multispeed_fiber()
5795 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; in ixgbe_setup_mac_link_multispeed_fiber()
5802 * @hw: pointer to hardware structure
5807 void ixgbe_set_soft_rate_select_speed(struct ixgbe_hw *hw, in ixgbe_set_soft_rate_select_speed() argument
5827 status = hw->phy.ops.read_i2c_byte(hw, IXGBE_SFF_SFF_8472_OSCB, in ixgbe_set_soft_rate_select_speed()
5837 status = hw->phy.ops.write_i2c_byte(hw, IXGBE_SFF_SFF_8472_OSCB, in ixgbe_set_soft_rate_select_speed()
5846 status = hw->phy.ops.read_i2c_byte(hw, IXGBE_SFF_SFF_8472_ESCB, in ixgbe_set_soft_rate_select_speed()
5856 status = hw->phy.ops.write_i2c_byte(hw, IXGBE_SFF_SFF_8472_ESCB, in ixgbe_set_soft_rate_select_speed()