11/*******************************************************************************
22
33 Intel PRO/1000 Linux driver
4- Copyright(c) 1999 - 2007 Intel Corporation.
4+ Copyright(c) 1999 - 2008 Intel Corporation.
55
66 This program is free software; you can redistribute it and/or modify it
77 under the terms and conditions of the GNU General Public License,
2929/*
3030 * 82571EB Gigabit Ethernet Controller
3131 * 82571EB Gigabit Ethernet Controller (Fiber)
32+ * 82571EB Dual Port Gigabit Mezzanine Adapter
33+ * 82571EB Quad Port Gigabit Mezzanine Adapter
34+ * 82571PT Gigabit PT Quad Port Server ExpressModule
3235 * 82572EI Gigabit Ethernet Controller (Copper)
3336 * 82572EI Gigabit Ethernet Controller (Fiber)
3437 * 82572EI Gigabit Ethernet Controller
@@ -72,7 +75,7 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
7275 struct e1000_phy_info * phy = & hw -> phy ;
7376 s32 ret_val ;
7477
75- if (hw -> media_type != e1000_media_type_copper ) {
78+ if (hw -> phy . media_type != e1000_media_type_copper ) {
7679 phy -> type = e1000_phy_none ;
7780 return 0 ;
7881 }
@@ -150,7 +153,8 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
150153 if (((eecd >> 15 ) & 0x3 ) == 0x3 ) {
151154 nvm -> type = e1000_nvm_flash_hw ;
152155 nvm -> word_size = 2048 ;
153- /* Autonomous Flash update bit must be cleared due
156+ /*
157+ * Autonomous Flash update bit must be cleared due
154158 * to Flash update issue.
155159 */
156160 eecd &= ~E1000_EECD_AUPDEN ;
@@ -159,10 +163,11 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
159163 }
160164 /* Fall Through */
161165 default :
162- nvm -> type = e1000_nvm_eeprom_spi ;
166+ nvm -> type = e1000_nvm_eeprom_spi ;
163167 size = (u16 )((eecd & E1000_EECD_SIZE_EX_MASK ) >>
164168 E1000_EECD_SIZE_EX_SHIFT );
165- /* Added to a constant, "size" becomes the left-shift value
169+ /*
170+ * Added to a constant, "size" becomes the left-shift value
166171 * for setting word_size.
167172 */
168173 size += NVM_WORD_SIZE_BASE_SHIFT ;
@@ -190,16 +195,16 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
190195 case E1000_DEV_ID_82571EB_FIBER :
191196 case E1000_DEV_ID_82572EI_FIBER :
192197 case E1000_DEV_ID_82571EB_QUAD_FIBER :
193- hw -> media_type = e1000_media_type_fiber ;
198+ hw -> phy . media_type = e1000_media_type_fiber ;
194199 break ;
195200 case E1000_DEV_ID_82571EB_SERDES :
196201 case E1000_DEV_ID_82572EI_SERDES :
197202 case E1000_DEV_ID_82571EB_SERDES_DUAL :
198203 case E1000_DEV_ID_82571EB_SERDES_QUAD :
199- hw -> media_type = e1000_media_type_internal_serdes ;
204+ hw -> phy . media_type = e1000_media_type_internal_serdes ;
200205 break ;
201206 default :
202- hw -> media_type = e1000_media_type_copper ;
207+ hw -> phy . media_type = e1000_media_type_copper ;
203208 break ;
204209 }
205210
@@ -208,25 +213,28 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
208213 /* Set rar entry count */
209214 mac -> rar_entry_count = E1000_RAR_ENTRIES ;
210215 /* Set if manageability features are enabled. */
211- mac -> arc_subsystem_valid =
212- (er32 (FWSM ) & E1000_FWSM_MODE_MASK ) ? 1 : 0 ;
216+ mac -> arc_subsystem_valid = (er32 (FWSM ) & E1000_FWSM_MODE_MASK ) ? 1 : 0 ;
213217
214218 /* check for link */
215- switch (hw -> media_type ) {
219+ switch (hw -> phy . media_type ) {
216220 case e1000_media_type_copper :
217221 func -> setup_physical_interface = e1000_setup_copper_link_82571 ;
218222 func -> check_for_link = e1000e_check_for_copper_link ;
219223 func -> get_link_up_info = e1000e_get_speed_and_duplex_copper ;
220224 break ;
221225 case e1000_media_type_fiber :
222- func -> setup_physical_interface = e1000_setup_fiber_serdes_link_82571 ;
226+ func -> setup_physical_interface =
227+ e1000_setup_fiber_serdes_link_82571 ;
223228 func -> check_for_link = e1000e_check_for_fiber_link ;
224- func -> get_link_up_info = e1000e_get_speed_and_duplex_fiber_serdes ;
229+ func -> get_link_up_info =
230+ e1000e_get_speed_and_duplex_fiber_serdes ;
225231 break ;
226232 case e1000_media_type_internal_serdes :
227- func -> setup_physical_interface = e1000_setup_fiber_serdes_link_82571 ;
233+ func -> setup_physical_interface =
234+ e1000_setup_fiber_serdes_link_82571 ;
228235 func -> check_for_link = e1000e_check_for_serdes_link ;
229- func -> get_link_up_info = e1000e_get_speed_and_duplex_fiber_serdes ;
236+ func -> get_link_up_info =
237+ e1000e_get_speed_and_duplex_fiber_serdes ;
230238 break ;
231239 default :
232240 return - E1000_ERR_CONFIG ;
@@ -322,10 +330,12 @@ static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)
322330 switch (hw -> mac .type ) {
323331 case e1000_82571 :
324332 case e1000_82572 :
325- /* The 82571 firmware may still be configuring the PHY.
333+ /*
334+ * The 82571 firmware may still be configuring the PHY.
326335 * In this case, we cannot access the PHY until the
327336 * configuration is done. So we explicitly set the
328- * PHY ID. */
337+ * PHY ID.
338+ */
329339 phy -> id = IGP01E1000_I_PHY_ID ;
330340 break ;
331341 case e1000_82573 :
@@ -479,8 +489,10 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
479489 if (ret_val )
480490 return ret_val ;
481491
482- /* If our nvm is an EEPROM, then we're done
483- * otherwise, commit the checksum to the flash NVM. */
492+ /*
493+ * If our nvm is an EEPROM, then we're done
494+ * otherwise, commit the checksum to the flash NVM.
495+ */
484496 if (hw -> nvm .type != e1000_nvm_flash_hw )
485497 return ret_val ;
486498
@@ -496,7 +508,8 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
496508
497509 /* Reset the firmware if using STM opcode. */
498510 if ((er32 (FLOP ) & 0xFF00 ) == E1000_STM_OPCODE ) {
499- /* The enabling of and the actual reset must be done
511+ /*
512+ * The enabling of and the actual reset must be done
500513 * in two write cycles.
501514 */
502515 ew32 (HICR , E1000_HICR_FW_RESET_ENABLE );
@@ -557,8 +570,10 @@ static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
557570 u32 eewr = 0 ;
558571 s32 ret_val = 0 ;
559572
560- /* A check for invalid values: offset too large, too many words,
561- * and not enough words. */
573+ /*
574+ * A check for invalid values: offset too large, too many words,
575+ * and not enough words.
576+ */
562577 if ((offset >= nvm -> word_size ) || (words > (nvm -> word_size - offset )) ||
563578 (words == 0 )) {
564579 hw_dbg (hw , "nvm parameter(s) out of bounds\n" );
@@ -645,30 +660,32 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
645660 } else {
646661 data &= ~IGP02E1000_PM_D0_LPLU ;
647662 ret_val = e1e_wphy (hw , IGP02E1000_PHY_POWER_MGMT , data );
648- /* LPLU and SmartSpeed are mutually exclusive. LPLU is used
663+ /*
664+ * LPLU and SmartSpeed are mutually exclusive. LPLU is used
649665 * during Dx states where the power conservation is most
650666 * important. During driver activity we should enable
651- * SmartSpeed, so performance is maintained. */
667+ * SmartSpeed, so performance is maintained.
668+ */
652669 if (phy -> smart_speed == e1000_smart_speed_on ) {
653670 ret_val = e1e_rphy (hw , IGP01E1000_PHY_PORT_CONFIG ,
654- & data );
671+ & data );
655672 if (ret_val )
656673 return ret_val ;
657674
658675 data |= IGP01E1000_PSCFR_SMART_SPEED ;
659676 ret_val = e1e_wphy (hw , IGP01E1000_PHY_PORT_CONFIG ,
660- data );
677+ data );
661678 if (ret_val )
662679 return ret_val ;
663680 } else if (phy -> smart_speed == e1000_smart_speed_off ) {
664681 ret_val = e1e_rphy (hw , IGP01E1000_PHY_PORT_CONFIG ,
665- & data );
682+ & data );
666683 if (ret_val )
667684 return ret_val ;
668685
669686 data &= ~IGP01E1000_PSCFR_SMART_SPEED ;
670687 ret_val = e1e_wphy (hw , IGP01E1000_PHY_PORT_CONFIG ,
671- data );
688+ data );
672689 if (ret_val )
673690 return ret_val ;
674691 }
@@ -693,7 +710,8 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
693710 s32 ret_val ;
694711 u16 i = 0 ;
695712
696- /* Prevent the PCI-E bus from sticking if there is no TLP connection
713+ /*
714+ * Prevent the PCI-E bus from sticking if there is no TLP connection
697715 * on the last TLP read/write transaction when MAC is reset.
698716 */
699717 ret_val = e1000e_disable_pcie_master (hw );
@@ -709,8 +727,10 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
709727
710728 msleep (10 );
711729
712- /* Must acquire the MDIO ownership before MAC reset.
713- * Ownership defaults to firmware after a reset. */
730+ /*
731+ * Must acquire the MDIO ownership before MAC reset.
732+ * Ownership defaults to firmware after a reset.
733+ */
714734 if (hw -> mac .type == e1000_82573 ) {
715735 extcnf_ctrl = er32 (EXTCNF_CTRL );
716736 extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP ;
@@ -747,7 +767,8 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
747767 /* We don't want to continue accessing MAC registers. */
748768 return ret_val ;
749769
750- /* Phy configuration from NVM just starts after EECD_AUTO_RD is set.
770+ /*
771+ * Phy configuration from NVM just starts after EECD_AUTO_RD is set.
751772 * Need to wait for Phy configuration completion before accessing
752773 * NVM and Phy.
753774 */
@@ -793,7 +814,8 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
793814 e1000e_clear_vfta (hw );
794815
795816 /* Setup the receive address. */
796- /* If, however, a locally administered address was assigned to the
817+ /*
818+ * If, however, a locally administered address was assigned to the
797819 * 82571, we must reserve a RAR for it to work around an issue where
798820 * resetting one port will reload the MAC on the other port.
799821 */
@@ -830,7 +852,8 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
830852 ew32 (GCR , reg_data );
831853 }
832854
833- /* Clear all of the statistics registers (clear on read). It is
855+ /*
856+ * Clear all of the statistics registers (clear on read). It is
834857 * important that we do this after we have tried to establish link
835858 * because the symbol error count will increment wildly if there
836859 * is no link.
@@ -922,7 +945,8 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
922945
923946 if (hw -> mac .type == e1000_82573 ) {
924947 if (hw -> mng_cookie .vlan_id != 0 ) {
925- /* The VFTA is a 4096b bit-field, each identifying
948+ /*
949+ * The VFTA is a 4096b bit-field, each identifying
926950 * a single VLAN ID. The following operations
927951 * determine which 32b entry (i.e. offset) into the
928952 * array we want to set the VLAN ID (i.e. bit) of
@@ -936,7 +960,8 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
936960 }
937961 }
938962 for (offset = 0 ; offset < E1000_VLAN_FILTER_TBL_SIZE ; offset ++ ) {
939- /* If the offset we want to clear is the same offset of the
963+ /*
964+ * If the offset we want to clear is the same offset of the
940965 * manageability VLAN ID, then clear all bits except that of
941966 * the manageability unit.
942967 */
@@ -947,7 +972,7 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
947972}
948973
949974/**
950- * e1000_mc_addr_list_update_82571 - Update Multicast addresses
975+ * e1000_update_mc_addr_list_82571 - Update Multicast addresses
951976 * @hw: pointer to the HW structure
952977 * @mc_addr_list: array of multicast addresses to program
953978 * @mc_addr_count: number of multicast addresses to program
@@ -959,7 +984,7 @@ void e1000e_clear_vfta(struct e1000_hw *hw)
959984 * The parameter rar_count will usually be hw->mac.rar_entry_count
960985 * unless there are workarounds that change this.
961986 **/
962- static void e1000_mc_addr_list_update_82571 (struct e1000_hw * hw ,
987+ static void e1000_update_mc_addr_list_82571 (struct e1000_hw * hw ,
963988 u8 * mc_addr_list ,
964989 u32 mc_addr_count ,
965990 u32 rar_used_count ,
@@ -968,8 +993,8 @@ static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw,
968993 if (e1000e_get_laa_state_82571 (hw ))
969994 rar_count -- ;
970995
971- e1000e_mc_addr_list_update_generic (hw , mc_addr_list , mc_addr_count ,
972- rar_used_count , rar_count );
996+ e1000e_update_mc_addr_list_generic (hw , mc_addr_list , mc_addr_count ,
997+ rar_used_count , rar_count );
973998}
974999
9751000/**
@@ -984,12 +1009,13 @@ static void e1000_mc_addr_list_update_82571(struct e1000_hw *hw,
9841009 **/
9851010static s32 e1000_setup_link_82571 (struct e1000_hw * hw )
9861011{
987- /* 82573 does not have a word in the NVM to determine
1012+ /*
1013+ * 82573 does not have a word in the NVM to determine
9881014 * the default flow control setting, so we explicitly
9891015 * set it to full.
9901016 */
9911017 if (hw -> mac .type == e1000_82573 )
992- hw -> mac . fc = e1000_fc_full ;
1018+ hw -> fc . type = e1000_fc_full ;
9931019
9941020 return e1000e_setup_link (hw );
9951021}
@@ -1050,14 +1076,14 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)
10501076 switch (hw -> mac .type ) {
10511077 case e1000_82571 :
10521078 case e1000_82572 :
1053- /* If SerDes loopback mode is entered, there is no form
1079+ /*
1080+ * If SerDes loopback mode is entered, there is no form
10541081 * of reset to take the adapter out of that mode. So we
10551082 * have to explicitly take the adapter out of loopback
10561083 * mode. This prevents drivers from twiddling their thumbs
10571084 * if another tool failed to take it out of loopback mode.
10581085 */
1059- ew32 (SCTL ,
1060- E1000_SCTL_DISABLE_SERDES_LOOPBACK );
1086+ ew32 (SCTL , E1000_SCTL_DISABLE_SERDES_LOOPBACK );
10611087 break ;
10621088 default :
10631089 break ;
@@ -1124,7 +1150,8 @@ void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state)
11241150
11251151 /* If workaround is activated... */
11261152 if (state )
1127- /* Hold a copy of the LAA in RAR[14] This is done so that
1153+ /*
1154+ * Hold a copy of the LAA in RAR[14] This is done so that
11281155 * between the time RAR[0] gets clobbered and the time it
11291156 * gets fixed, the actual LAA is in one of the RARs and no
11301157 * incoming packets directed to this port are dropped.
@@ -1152,15 +1179,17 @@ static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)
11521179 if (nvm -> type != e1000_nvm_flash_hw )
11531180 return 0 ;
11541181
1155- /* Check bit 4 of word 10h. If it is 0, firmware is done updating
1182+ /*
1183+ * Check bit 4 of word 10h. If it is 0, firmware is done updating
11561184 * 10h-12h. Checksum may need to be fixed.
11571185 */
11581186 ret_val = e1000_read_nvm (hw , 0x10 , 1 , & data );
11591187 if (ret_val )
11601188 return ret_val ;
11611189
11621190 if (!(data & 0x10 )) {
1163- /* Read 0x23 and check bit 15. This bit is a 1
1191+ /*
1192+ * Read 0x23 and check bit 15. This bit is a 1
11641193 * when the checksum has already been fixed. If
11651194 * the checksum is still wrong and this bit is a
11661195 * 1, we need to return bad checksum. Otherwise,
@@ -1240,7 +1269,7 @@ static struct e1000_mac_operations e82571_mac_ops = {
12401269 /* .get_link_up_info: media type dependent */
12411270 .led_on = e1000e_led_on_generic ,
12421271 .led_off = e1000e_led_off_generic ,
1243- .mc_addr_list_update = e1000_mc_addr_list_update_82571 ,
1272+ .update_mc_addr_list = e1000_update_mc_addr_list_82571 ,
12441273 .reset_hw = e1000_reset_hw_82571 ,
12451274 .init_hw = e1000_init_hw_82571 ,
12461275 .setup_link = e1000_setup_link_82571 ,
0 commit comments