FreeBSD Bugzilla – Attachment 97433 Details for
Bug 136168
[em] em driver initialization fails on Intel 5000PSL motherboard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 5.74 KB, created by
Stephen Sanders
on 2009-06-29 21:40:04 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Stephen Sanders
Created:
2009-06-29 21:40:04 UTC
Size:
5.74 KB
patch
obsolete
>diff -uNr ./dev/em/if_em.c ../sys.new/dev/em/if_em.c >--- ./dev/em/if_em.c 2007-11-06 20:33:28.000000000 -0500 >+++ ../sys.new/dev/em/if_em.c 2009-06-29 15:51:07.000000000 -0400 >@@ -344,6 +344,7 @@ > #define EM_TICKS_TO_USECS(ticks) ((1024 * (ticks) + 500) / 1000) > #define EM_USECS_TO_TICKS(usecs) ((1000 * (usecs) + 512) / 1024) > #define M_TSO_LEN 66 >+#define DEVICE_INIT_RETRIES 3 > > /* Allow common code without TSO */ > #ifndef CSUM_TSO >@@ -2839,66 +2840,77 @@ > { > device_t dev = adapter->dev; > uint16_t rx_buffer_size; >+ int i = 0; > > INIT_DEBUGOUT("em_hardware_init: begin"); > >- /* Issue a global reset */ >- e1000_reset_hw(&adapter->hw); >- >- /* Get control from any management/hw control */ >- if (((adapter->hw.mac.type == e1000_82573) || >- (adapter->hw.mac.type == e1000_ich8lan) || >- (adapter->hw.mac.type == e1000_ich9lan)) && >- e1000_check_mng_mode(&adapter->hw)) >- em_get_hw_control(adapter); >+ for( i=0; i< DEVICE_INIT_RETRIES; i++ ) { > >- /* When hardware is reset, fifo_head is also reset */ >- adapter->tx_fifo_head = 0; >+ /* Issue a global reset */ >+ e1000_reset_hw(&adapter->hw); > >- /* Set up smart power down as default off on newer adapters. */ >- if (!em_smart_pwr_down && (adapter->hw.mac.type == e1000_82571 || >- adapter->hw.mac.type == e1000_82572)) { >- uint16_t phy_tmp = 0; >- >- /* Speed up time to link by disabling smart power down. */ >- e1000_read_phy_reg(&adapter->hw, >- IGP02E1000_PHY_POWER_MGMT, &phy_tmp); >- phy_tmp &= ~IGP02E1000_PM_SPD; >- e1000_write_phy_reg(&adapter->hw, >- IGP02E1000_PHY_POWER_MGMT, phy_tmp); >- } >- >- /* >- * These parameters control the automatic generation (Tx) and >- * response (Rx) to Ethernet PAUSE frames. >- * - High water mark should allow for at least two frames to be >- * received after sending an XOFF. >- * - Low water mark works best when it is very near the high water mark. >- * This allows the receiver to restart by sending XON when it has >- * drained a bit. Here we use an arbitary value of 1500 which will >- * restart after one full frame is pulled from the buffer. There >- * could be several smaller frames in the buffer and if so they will >- * not trigger the XON until their total number reduces the buffer >- * by 1500. >- * - The pause time is fairly large at 1000 x 512ns = 512 usec. >- */ >- rx_buffer_size = ((E1000_READ_REG(&adapter->hw, E1000_PBA) & >- 0xffff) << 10 ); >- >- adapter->hw.fc.high_water = rx_buffer_size - >- roundup2(adapter->max_frame_size, 1024); >- adapter->hw.fc.low_water = adapter->hw.fc.high_water - 1500; >- >- if (adapter->hw.mac.type == e1000_80003es2lan) >- adapter->hw.fc.pause_time = 0xFFFF; >- else >- adapter->hw.fc.pause_time = EM_FC_PAUSE_TIME; >- adapter->hw.fc.send_xon = TRUE; >- adapter->hw.fc.type = e1000_fc_full; >- >- if (e1000_init_hw(&adapter->hw) < 0) { >- device_printf(dev, "Hardware Initialization Failed\n"); >- return (EIO); >+ /* Get control from any management/hw control */ >+ if (((adapter->hw.mac.type == e1000_82573) || >+ (adapter->hw.mac.type == e1000_ich8lan) || >+ (adapter->hw.mac.type == e1000_ich9lan)) && >+ e1000_check_mng_mode(&adapter->hw)) >+ em_get_hw_control(adapter); >+ >+ /* When hardware is reset, fifo_head is also reset */ >+ adapter->tx_fifo_head = 0; >+ >+ /* Set up smart power down as default off on newer adapters. */ >+ if (!em_smart_pwr_down && (adapter->hw.mac.type == e1000_82571 || >+ adapter->hw.mac.type == e1000_82572)) { >+ uint16_t phy_tmp = 0; >+ >+ /* Speed up time to link by disabling smart power down. */ >+ e1000_read_phy_reg(&adapter->hw, >+ IGP02E1000_PHY_POWER_MGMT, &phy_tmp); >+ phy_tmp &= ~IGP02E1000_PM_SPD; >+ e1000_write_phy_reg(&adapter->hw, >+ IGP02E1000_PHY_POWER_MGMT, phy_tmp); >+ } >+ >+ /* >+ * These parameters control the automatic generation (Tx) and >+ * response (Rx) to Ethernet PAUSE frames. >+ * - High water mark should allow for at least two frames to be >+ * received after sending an XOFF. >+ * - Low water mark works best when it is very near the high water mark. >+ * This allows the receiver to restart by sending XON when it has >+ * drained a bit. Here we use an arbitary value of 1500 which will >+ * restart after one full frame is pulled from the buffer. There >+ * could be several smaller frames in the buffer and if so they will >+ * not trigger the XON until their total number reduces the buffer >+ * by 1500. >+ * - The pause time is fairly large at 1000 x 512ns = 512 usec. >+ */ >+ rx_buffer_size = ((E1000_READ_REG(&adapter->hw, E1000_PBA) & >+ 0xffff) << 10 ); >+ >+ adapter->hw.fc.high_water = rx_buffer_size - >+ roundup2(adapter->max_frame_size, 1024); >+ adapter->hw.fc.low_water = adapter->hw.fc.high_water - 1500; >+ >+ if (adapter->hw.mac.type == e1000_80003es2lan) >+ adapter->hw.fc.pause_time = 0xFFFF; >+ else >+ adapter->hw.fc.pause_time = EM_FC_PAUSE_TIME; >+ adapter->hw.fc.send_xon = TRUE; >+ adapter->hw.fc.type = e1000_fc_full; >+ >+ if (e1000_init_hw(&adapter->hw) < 0) { >+ device_printf(dev, >+ "Hardware Initialization Failed %d of %d\n", >+ i+1, DEVICE_INIT_RETRIES ); >+ >+ if( i < DEVICE_INIT_RETRIES) >+ continue; >+ >+ return (EIO); >+ } >+ break; > } > > e1000_check_for_link(&adapter->hw);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 136168
: 97433