1 /******************************************************************************
2
3 Copyright (c) 2001-2012, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15
16 3. Neither the name of the Intel Corporation nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
74 status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
75 break;
76 }
77
78 return status;
79 }
80
81 /**
82 * ixgbe_set_mac_type - Sets MAC type
83 * @hw: pointer to the HW structure
84 *
85 * This function sets the mac type of the adapter based on the
86 * vendor ID and device ID stored in the hw structure.
87 **/
88 s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
89 {
90 s32 ret_val = IXGBE_SUCCESS;
91
92 DEBUGFUNC("ixgbe_set_mac_type\n");
93
94 if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) {
95 switch (hw->device_id) {
96 case IXGBE_DEV_ID_82598:
97 case IXGBE_DEV_ID_82598_BX:
98 case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
99 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
100 case IXGBE_DEV_ID_82598AT:
101 case IXGBE_DEV_ID_82598AT2:
102 case IXGBE_DEV_ID_82598EB_CX4:
103 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
104 case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
105 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
106 case IXGBE_DEV_ID_82598EB_XF_LR:
107 case IXGBE_DEV_ID_82598EB_SFP_LOM:
108 hw->mac.type = ixgbe_mac_82598EB;
109 break;
110 case IXGBE_DEV_ID_82599_KX4:
111 case IXGBE_DEV_ID_82599_KX4_MEZZ:
112 case IXGBE_DEV_ID_82599_XAUI_LOM:
113 case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
114 case IXGBE_DEV_ID_82599_KR:
115 case IXGBE_DEV_ID_82599_SFP:
116 case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
117 case IXGBE_DEV_ID_82599_SFP_FCOE:
118 case IXGBE_DEV_ID_82599_SFP_EM:
119 case IXGBE_DEV_ID_82599_SFP_SF2:
120 case IXGBE_DEV_ID_82599EN_SFP:
121 case IXGBE_DEV_ID_82599_CX4:
122 case IXGBE_DEV_ID_82599_T3_LOM:
123 hw->mac.type = ixgbe_mac_82599EB;
124 break;
125 case IXGBE_DEV_ID_82599_VF:
126 hw->mac.type = ixgbe_mac_82599_vf;
127 break;
128 case IXGBE_DEV_ID_X540_VF:
129 hw->mac.type = ixgbe_mac_X540_vf;
130 break;
131 case IXGBE_DEV_ID_X540T:
132 case IXGBE_DEV_ID_X540T1:
133 hw->mac.type = ixgbe_mac_X540;
134 break;
135 default:
136 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
137 break;
138 }
139 } else {
140 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
141 }
142
143 DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
144 hw->mac.type, ret_val);
145 return ret_val;
146 }
147
148 /**
149 * ixgbe_init_hw - Initialize the hardware
150 * @hw: pointer to hardware structure
151 *
152 * Initialize the hardware by resetting and then starting the hardware
153 **/
154 s32 ixgbe_init_hw(struct ixgbe_hw *hw)
155 {
156 return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
157 IXGBE_NOT_IMPLEMENTED);
158 }
159
160 /**
161 * ixgbe_reset_hw - Performs a hardware reset
505 }
506
507 /**
508 * ixgbe_check_phy_link - Determine link and speed status
509 * @hw: pointer to hardware structure
510 *
511 * Reads a PHY register to determine if link is up and the current speed for
512 * the PHY.
513 **/
514 s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
515 bool *link_up)
516 {
517 return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
518 link_up), IXGBE_NOT_IMPLEMENTED);
519 }
520
521 /**
522 * ixgbe_setup_phy_link_speed - Set auto advertise
523 * @hw: pointer to hardware structure
524 * @speed: new link speed
525 * @autoneg: TRUE if autonegotiation enabled
526 *
527 * Sets the auto advertised capabilities
528 **/
529 s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
530 bool autoneg,
531 bool autoneg_wait_to_complete)
532 {
533 return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
534 autoneg, autoneg_wait_to_complete),
535 IXGBE_NOT_IMPLEMENTED);
536 }
537
538 /**
539 * ixgbe_check_link - Get link and speed status
540 * @hw: pointer to hardware structure
541 *
542 * Reads the links register to determine if link is up and the current speed
543 **/
544 s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
545 bool *link_up, bool link_up_wait_to_complete)
546 {
547 return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
548 link_up, link_up_wait_to_complete),
549 IXGBE_NOT_IMPLEMENTED);
550 }
551
552 /**
553 * ixgbe_disable_tx_laser - Disable Tx laser
554 * @hw: pointer to hardware structure
574 }
575
576 /**
577 * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
578 * @hw: pointer to hardware structure
579 *
580 * When the driver changes the link speeds that it can support then
581 * flap the tx laser to alert the link partner to start autotry
582 * process on its end.
583 **/
584 void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
585 {
586 if (hw->mac.ops.flap_tx_laser)
587 hw->mac.ops.flap_tx_laser(hw);
588 }
589
590 /**
591 * ixgbe_setup_link - Set link speed
592 * @hw: pointer to hardware structure
593 * @speed: new link speed
594 * @autoneg: TRUE if autonegotiation enabled
595 *
596 * Configures link settings. Restarts the link.
597 * Performs autonegotiation if needed.
598 **/
599 s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
600 bool autoneg,
601 bool autoneg_wait_to_complete)
602 {
603 return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
604 autoneg, autoneg_wait_to_complete),
605 IXGBE_NOT_IMPLEMENTED);
606 }
607
608 /**
609 * ixgbe_get_link_capabilities - Returns link capabilities
610 * @hw: pointer to hardware structure
611 *
612 * Determines the link capabilities of the current configuration.
613 **/
614 s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
615 bool *autoneg)
616 {
617 return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
618 speed, autoneg), IXGBE_NOT_IMPLEMENTED);
619 }
620
621 /**
622 * ixgbe_led_on - Turn on LEDs
623 * @hw: pointer to hardware structure
624 * @index: led number to turn on
|
1 /******************************************************************************
2
3 Copyright (c) 2001-2013, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15
16 3. Neither the name of the Intel Corporation nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
74 status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
75 break;
76 }
77
78 return status;
79 }
80
81 /**
82 * ixgbe_set_mac_type - Sets MAC type
83 * @hw: pointer to the HW structure
84 *
85 * This function sets the mac type of the adapter based on the
86 * vendor ID and device ID stored in the hw structure.
87 **/
88 s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
89 {
90 s32 ret_val = IXGBE_SUCCESS;
91
92 DEBUGFUNC("ixgbe_set_mac_type\n");
93
94 switch (hw->device_id) {
95 case IXGBE_DEV_ID_82598:
96 case IXGBE_DEV_ID_82598_BX:
97 case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
98 case IXGBE_DEV_ID_82598AF_DUAL_PORT:
99 case IXGBE_DEV_ID_82598AT:
100 case IXGBE_DEV_ID_82598AT2:
101 case IXGBE_DEV_ID_82598EB_CX4:
102 case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
103 case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
104 case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
105 case IXGBE_DEV_ID_82598EB_XF_LR:
106 case IXGBE_DEV_ID_82598EB_SFP_LOM:
107 hw->mac.type = ixgbe_mac_82598EB;
108 break;
109 case IXGBE_DEV_ID_82599_KX4:
110 case IXGBE_DEV_ID_82599_KX4_MEZZ:
111 case IXGBE_DEV_ID_82599_XAUI_LOM:
112 case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
113 case IXGBE_DEV_ID_82599_KR:
114 case IXGBE_DEV_ID_82599_SFP:
115 case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
116 case IXGBE_DEV_ID_82599_SFP_FCOE:
117 case IXGBE_DEV_ID_82599_SFP_EM:
118 case IXGBE_DEV_ID_82599_SFP_SF2:
119 case IXGBE_DEV_ID_82599_SFP_SF_QP:
120 case IXGBE_DEV_ID_82599EN_SFP:
121 case IXGBE_DEV_ID_82599_CX4:
122 case IXGBE_DEV_ID_82599_BYPASS:
123 case IXGBE_DEV_ID_82599_T3_LOM:
124 hw->mac.type = ixgbe_mac_82599EB;
125 break;
126 case IXGBE_DEV_ID_82599_VF:
127 case IXGBE_DEV_ID_82599_VF_HV:
128 hw->mac.type = ixgbe_mac_82599_vf;
129 break;
130 case IXGBE_DEV_ID_X540_VF:
131 case IXGBE_DEV_ID_X540_VF_HV:
132 hw->mac.type = ixgbe_mac_X540_vf;
133 break;
134 case IXGBE_DEV_ID_X540T:
135 case IXGBE_DEV_ID_X540_BYPASS:
136 hw->mac.type = ixgbe_mac_X540;
137 break;
138 default:
139 ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
140 break;
141 }
142
143 DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
144 hw->mac.type, ret_val);
145 return ret_val;
146 }
147
148 /**
149 * ixgbe_init_hw - Initialize the hardware
150 * @hw: pointer to hardware structure
151 *
152 * Initialize the hardware by resetting and then starting the hardware
153 **/
154 s32 ixgbe_init_hw(struct ixgbe_hw *hw)
155 {
156 return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
157 IXGBE_NOT_IMPLEMENTED);
158 }
159
160 /**
161 * ixgbe_reset_hw - Performs a hardware reset
505 }
506
507 /**
508 * ixgbe_check_phy_link - Determine link and speed status
509 * @hw: pointer to hardware structure
510 *
511 * Reads a PHY register to determine if link is up and the current speed for
512 * the PHY.
513 **/
514 s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
515 bool *link_up)
516 {
517 return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
518 link_up), IXGBE_NOT_IMPLEMENTED);
519 }
520
521 /**
522 * ixgbe_setup_phy_link_speed - Set auto advertise
523 * @hw: pointer to hardware structure
524 * @speed: new link speed
525 *
526 * Sets the auto advertised capabilities
527 **/
528 s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
529 bool autoneg_wait_to_complete)
530 {
531 return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
532 autoneg_wait_to_complete),
533 IXGBE_NOT_IMPLEMENTED);
534 }
535
536 /**
537 * ixgbe_check_link - Get link and speed status
538 * @hw: pointer to hardware structure
539 *
540 * Reads the links register to determine if link is up and the current speed
541 **/
542 s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
543 bool *link_up, bool link_up_wait_to_complete)
544 {
545 return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
546 link_up, link_up_wait_to_complete),
547 IXGBE_NOT_IMPLEMENTED);
548 }
549
550 /**
551 * ixgbe_disable_tx_laser - Disable Tx laser
552 * @hw: pointer to hardware structure
572 }
573
574 /**
575 * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
576 * @hw: pointer to hardware structure
577 *
578 * When the driver changes the link speeds that it can support then
579 * flap the tx laser to alert the link partner to start autotry
580 * process on its end.
581 **/
582 void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
583 {
584 if (hw->mac.ops.flap_tx_laser)
585 hw->mac.ops.flap_tx_laser(hw);
586 }
587
588 /**
589 * ixgbe_setup_link - Set link speed
590 * @hw: pointer to hardware structure
591 * @speed: new link speed
592 *
593 * Configures link settings. Restarts the link.
594 * Performs autonegotiation if needed.
595 **/
596 s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
597 bool autoneg_wait_to_complete)
598 {
599 return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
600 autoneg_wait_to_complete),
601 IXGBE_NOT_IMPLEMENTED);
602 }
603
604 /**
605 * ixgbe_get_link_capabilities - Returns link capabilities
606 * @hw: pointer to hardware structure
607 *
608 * Determines the link capabilities of the current configuration.
609 **/
610 s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
611 bool *autoneg)
612 {
613 return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
614 speed, autoneg), IXGBE_NOT_IMPLEMENTED);
615 }
616
617 /**
618 * ixgbe_led_on - Turn on LEDs
619 * @hw: pointer to hardware structure
620 * @index: led number to turn on
|