| 351 | }; |
| 352 | |
| 353 | static int |
| 354 | em_hw_init(struct e1000_hw *hw) |
| 355 | { |
| 356 | int diag; |
| 357 | |
| 358 | diag = hw->mac.ops.init_params(hw); |
| 359 | if (diag != 0) { |
| 360 | PMD_INIT_LOG(ERR, "MAC Initialization Error"); |
| 361 | return diag; |
| 362 | } |
| 363 | diag = hw->nvm.ops.init_params(hw); |
| 364 | if (diag != 0) { |
| 365 | PMD_INIT_LOG(ERR, "NVM Initialization Error"); |
| 366 | return diag; |
| 367 | } |
| 368 | diag = hw->phy.ops.init_params(hw); |
| 369 | if (diag != 0) { |
| 370 | PMD_INIT_LOG(ERR, "PHY Initialization Error"); |
| 371 | return diag; |
| 372 | } |
| 373 | (void) e1000_get_bus_info(hw); |
| 374 | |
| 375 | hw->mac.autoneg = 1; |
| 376 | hw->phy.autoneg_wait_to_complete = 0; |
| 377 | hw->phy.autoneg_advertised = E1000_ALL_SPEED_DUPLEX; |
| 378 | |
| 379 | e1000_init_script_state_82541(hw, TRUE); |
| 380 | e1000_set_tbi_compatibility_82543(hw, TRUE); |
| 381 | |
| 382 | /* Copper options */ |
| 383 | if (hw->phy.media_type == e1000_media_type_copper) { |
| 384 | hw->phy.mdix = 0; /* AUTO_ALL_MODES */ |
| 385 | hw->phy.disable_polarity_correction = 0; |
| 386 | hw->phy.ms_type = e1000_ms_hw_default; |
| 387 | } |
| 388 | |
| 389 | /* |
| 390 | * Start from a known state, this is important in reading the nvm |
| 391 | * and mac from that. |
| 392 | */ |
| 393 | e1000_reset_hw(hw); |
| 394 | |
| 395 | /* Make sure we have a good EEPROM before we read from it */ |
| 396 | if (e1000_validate_nvm_checksum(hw) < 0) { |
| 397 | /* |
| 398 | * Some PCI-E parts fail the first check due to |
| 399 | * the link being in sleep state, call it again, |
| 400 | * if it fails a second time its a real issue. |
| 401 | */ |
| 402 | diag = e1000_validate_nvm_checksum(hw); |
| 403 | if (diag < 0) { |
| 404 | PMD_INIT_LOG(ERR, "EEPROM checksum invalid"); |
| 405 | goto error; |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | /* Read the permanent MAC address out of the EEPROM */ |
| 410 | diag = e1000_read_mac_addr(hw); |
no test coverage detected