Lines Matching refs:Adapter

161 static void e1000g_fm_init(struct e1000g *Adapter);
162 static void e1000g_fm_fini(struct e1000g *Adapter);
166 static void e1000g_restore_promisc(struct e1000g *Adapter);
405 struct e1000g *Adapter;
431 Adapter =
432 (struct e1000g *)kmem_zalloc(sizeof (*Adapter), KM_SLEEP);
434 Adapter->dip = devinfo;
435 Adapter->instance = instance;
436 Adapter->tx_ring->adapter = Adapter;
437 Adapter->rx_ring->adapter = Adapter;
439 hw = &Adapter->shared;
440 osdep = &Adapter->osdep;
442 osdep->adapter = Adapter;
444 ddi_set_driver_private(devinfo, (caddr_t)Adapter);
449 (void) e1000g_get_prop(Adapter, "fm-capable",
453 &Adapter->fm_capabilities);
454 e1000g_fm_init(Adapter);
455 Adapter->attach_progress |= ATTACH_PROGRESS_FMINIT;
461 e1000g_log(Adapter, CE_WARN, "PCI configuration failed");
464 Adapter->attach_progress |= ATTACH_PROGRESS_PCI_CONFIG;
469 if (e1000g_identify_hardware(Adapter) != DDI_SUCCESS) {
470 e1000g_log(Adapter, CE_WARN, "Identify hardware failed");
477 if (e1000g_regs_map(Adapter) != DDI_SUCCESS) {
478 e1000g_log(Adapter, CE_WARN, "Mapping registers failed");
481 Adapter->attach_progress |= ATTACH_PROGRESS_REGS_MAP;
486 if (e1000g_set_driver_params(Adapter) != DDI_SUCCESS) {
489 Adapter->attach_progress |= ATTACH_PROGRESS_SETUP;
491 if (e1000g_check_acc_handle(Adapter->osdep.cfg_handle) != DDI_FM_OK) {
492 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
504 if (e1000g_add_intrs(Adapter) != DDI_SUCCESS) {
505 e1000g_log(Adapter, CE_WARN, "Add interrupts failed");
508 Adapter->attach_progress |= ATTACH_PROGRESS_ADD_INTR;
516 e1000g_init_locks(Adapter);
517 Adapter->attach_progress |= ATTACH_PROGRESS_LOCKS;
522 if (e1000g_init_stats(Adapter) != DDI_SUCCESS) {
523 e1000g_log(Adapter, CE_WARN, "Init stats failed");
526 Adapter->attach_progress |= ATTACH_PROGRESS_KSTATS;
531 rw_enter(&Adapter->chip_lock, RW_WRITER);
532 if (e1000g_init(Adapter) != DDI_SUCCESS) {
533 rw_exit(&Adapter->chip_lock);
534 e1000g_log(Adapter, CE_WARN, "Adapter initialization failed");
537 rw_exit(&Adapter->chip_lock);
538 Adapter->attach_progress |= ATTACH_PROGRESS_INIT;
543 if (e1000g_register_mac(Adapter) != DDI_SUCCESS) {
544 e1000g_log(Adapter, CE_WARN, "Register MAC failed");
547 Adapter->attach_progress |= ATTACH_PROGRESS_MAC;
553 if (e1000g_enable_intrs(Adapter) != DDI_SUCCESS) {
554 e1000g_log(Adapter, CE_WARN, "Enable DDI interrupts failed");
557 Adapter->attach_progress |= ATTACH_PROGRESS_ENABLE_INTR;
567 Adapter->priv_dip =
569 bcopy(DEVI(devinfo), DEVI(Adapter->priv_dip),
576 devi_node->priv_dip = Adapter->priv_dip;
580 Adapter->priv_devi_node = devi_node;
595 Adapter->e1000g_state = E1000G_INITIALIZED;
599 e1000g_unattach(devinfo, Adapter);
604 e1000g_register_mac(struct e1000g *Adapter)
606 struct e1000_hw *hw = &Adapter->shared;
614 mac->m_driver = Adapter;
615 mac->m_dip = Adapter->dip;
619 mac->m_max_sdu = Adapter->default_mtu;
624 err = mac_register(mac, &Adapter->mh);
631 e1000g_identify_hardware(struct e1000g *Adapter)
633 struct e1000_hw *hw = &Adapter->shared;
634 struct e1000g_osdep *osdep = &Adapter->osdep;
649 E1000G_DEBUGLOG_0(Adapter, E1000G_INFO_LEVEL,
658 e1000g_regs_map(struct e1000g *Adapter)
660 dev_info_t *devinfo = Adapter->dip;
661 struct e1000_hw *hw = &Adapter->shared;
662 struct e1000g_osdep *osdep = &Adapter->osdep;
671 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
680 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
698 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
708 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
750 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
758 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
768 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
789 e1000g_set_driver_params(struct e1000g *Adapter)
793 hw = &Adapter->shared;
797 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
804 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
830 Adapter->strip_crc = B_TRUE;
832 Adapter->strip_crc = B_FALSE;
836 e1000g_setup_max_mtu(Adapter);
841 e1000g_force_speed_duplex(Adapter);
844 e1000g_get_max_frame_size(Adapter);
847 e1000g_get_conf(Adapter);
850 e1000g_pch_limits(Adapter);
853 e1000g_set_bufsize(Adapter);
856 Adapter->master_latency_timer = DEFAULT_MASTER_LATENCY_TIMER;
866 Adapter->link_state = LINK_STATE_UNKNOWN;
869 Adapter->rx_intr_delay = DEFAULT_RX_INTR_DELAY;
870 Adapter->rx_intr_abs_delay = DEFAULT_RX_INTR_ABS_DELAY;
873 Adapter->tx_intr_enable = DEFAULT_TX_INTR_ENABLE;
874 Adapter->tx_bcopy_thresh = DEFAULT_TX_BCOPY_THRESHOLD;
875 Adapter->tx_intr_delay = DEFAULT_TX_INTR_DELAY;
876 Adapter->tx_intr_abs_delay = DEFAULT_TX_INTR_ABS_DELAY;
879 Adapter->rx_bcopy_thresh = DEFAULT_RX_BCOPY_THRESHOLD;
885 e1000g_setup_max_mtu(struct e1000g *Adapter)
887 struct e1000_mac_info *mac = &Adapter->shared.mac;
888 struct e1000_phy_info *phy = &Adapter->shared.phy;
895 Adapter->max_mtu = ETHERMTU;
900 Adapter->max_mtu = ETHERMTU;
902 Adapter->max_mtu = MAXIMUM_MTU_9K;
906 Adapter->max_mtu = MAXIMUM_MTU_4K;
912 Adapter->max_mtu = MAXIMUM_MTU_9K;
922 Adapter->max_mtu = e1000g_jumbo_mtu;
924 Adapter->max_mtu = MAXIMUM_MTU_9K;
929 Adapter->max_mtu = FRAME_SIZE_UPTO_16K -
936 e1000g_set_bufsize(struct e1000g *Adapter)
938 struct e1000_mac_info *mac = &Adapter->shared.mac;
942 dev_info_t *devinfo = Adapter->dip;
947 Adapter->sys_page_sz = ddi_ptob(devinfo, (ulong_t)1);
952 if (Adapter->sys_page_sz == iommu_pagesize) {
954 Adapter->sys_page_sz = 0x4000;
956 if (Adapter->sys_page_sz > iommu_pagesize)
957 Adapter->sys_page_sz = iommu_pagesize;
960 if (Adapter->lso_enable) {
961 Adapter->dvma_page_num = E1000_LSO_MAXLEN /
962 Adapter->sys_page_sz + E1000G_DEFAULT_DVMA_PAGE_NUM;
964 Adapter->dvma_page_num = Adapter->max_frame_size /
965 Adapter->sys_page_sz + E1000G_DEFAULT_DVMA_PAGE_NUM;
967 ASSERT(Adapter->dvma_page_num >= E1000G_DEFAULT_DVMA_PAGE_NUM);
970 Adapter->min_frame_size = ETHERMIN + ETHERFCSL;
972 if (Adapter->mem_workaround_82546 &&
976 Adapter->rx_buffer_size = E1000_RX_BUFFER_SIZE_2K;
978 rx_size = Adapter->max_frame_size;
981 Adapter->rx_buffer_size = E1000_RX_BUFFER_SIZE_4K;
984 Adapter->rx_buffer_size = E1000_RX_BUFFER_SIZE_8K;
987 Adapter->rx_buffer_size = E1000_RX_BUFFER_SIZE_16K;
989 Adapter->rx_buffer_size = E1000_RX_BUFFER_SIZE_2K;
991 Adapter->rx_buffer_size += E1000G_IPALIGNROOM;
993 tx_size = Adapter->max_frame_size;
995 Adapter->tx_buffer_size = E1000_TX_BUFFER_SIZE_4K;
998 Adapter->tx_buffer_size = E1000_TX_BUFFER_SIZE_8K;
1001 Adapter->tx_buffer_size = E1000_TX_BUFFER_SIZE_16K;
1003 Adapter->tx_buffer_size = E1000_TX_BUFFER_SIZE_2K;
1017 Adapter->rx_buf_align = RECEIVE_BUFFER_ALIGN_SIZE;
1019 Adapter->rx_buf_align = 1;
1040 struct e1000g *Adapter;
1054 Adapter = (struct e1000g *)ddi_get_driver_private(devinfo);
1055 if (Adapter == NULL)
1058 rx_drain = e1000g_rx_drain(Adapter);
1062 if (mac_unregister(Adapter->mh) != 0) {
1063 e1000g_log(Adapter, CE_WARN, "Unregister MAC failed");
1066 Adapter->attach_progress &= ~ATTACH_PROGRESS_MAC;
1068 ASSERT(!(Adapter->e1000g_state & E1000G_STARTED));
1073 e1000g_unattach(devinfo, Adapter);
1101 e1000g_unattach(dev_info_t *devinfo, struct e1000g *Adapter)
1106 if (Adapter->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) {
1107 (void) e1000g_disable_intrs(Adapter);
1110 if (Adapter->attach_progress & ATTACH_PROGRESS_MAC) {
1111 (void) mac_unregister(Adapter->mh);
1114 if (Adapter->attach_progress & ATTACH_PROGRESS_ADD_INTR) {
1115 (void) e1000g_rem_intrs(Adapter);
1118 if (Adapter->attach_progress & ATTACH_PROGRESS_SETUP) {
1122 if (Adapter->attach_progress & ATTACH_PROGRESS_KSTATS) {
1123 kstat_delete((kstat_t *)Adapter->e1000g_ksp);
1126 if (Adapter->attach_progress & ATTACH_PROGRESS_INIT) {
1127 stop_link_timer(Adapter);
1130 result = e1000_reset_hw(&Adapter->shared);
1134 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1135 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
1139 e1000g_release_multicast(Adapter);
1141 if (Adapter->attach_progress & ATTACH_PROGRESS_REGS_MAP) {
1142 if (Adapter->osdep.reg_handle != NULL)
1143 ddi_regs_map_free(&Adapter->osdep.reg_handle);
1144 if (Adapter->osdep.ich_flash_handle != NULL &&
1145 Adapter->shared.mac.type != e1000_pch_spt)
1146 ddi_regs_map_free(&Adapter->osdep.ich_flash_handle);
1147 if (Adapter->osdep.io_reg_handle != NULL)
1148 ddi_regs_map_free(&Adapter->osdep.io_reg_handle);
1151 if (Adapter->attach_progress & ATTACH_PROGRESS_PCI_CONFIG) {
1152 if (Adapter->osdep.cfg_handle != NULL)
1153 pci_config_teardown(&Adapter->osdep.cfg_handle);
1156 if (Adapter->attach_progress & ATTACH_PROGRESS_LOCKS) {
1157 e1000g_destroy_locks(Adapter);
1160 if (Adapter->attach_progress & ATTACH_PROGRESS_FMINIT) {
1161 e1000g_fm_fini(Adapter);
1165 if (e1000g_force_detach && (Adapter->priv_devi_node != NULL)) {
1166 devi_node = Adapter->priv_devi_node;
1175 kmem_free((caddr_t)Adapter, sizeof (struct e1000g));
1243 e1000g_init_locks(struct e1000g *Adapter)
1248 rw_init(&Adapter->chip_lock, NULL,
1249 RW_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1250 mutex_init(&Adapter->link_lock, NULL,
1251 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1252 mutex_init(&Adapter->watchdog_lock, NULL,
1253 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1255 tx_ring = Adapter->tx_ring;
1258 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1260 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1262 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1264 rx_ring = Adapter->rx_ring;
1267 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1271 e1000g_destroy_locks(struct e1000g *Adapter)
1276 tx_ring = Adapter->tx_ring;
1281 rx_ring = Adapter->rx_ring;
1284 mutex_destroy(&Adapter->link_lock);
1285 mutex_destroy(&Adapter->watchdog_lock);
1286 rw_destroy(&Adapter->chip_lock);
1289 e1000_destroy_hw_mutex(&Adapter->shared);
1295 struct e1000g *Adapter;
1297 Adapter = (struct e1000g *)ddi_get_driver_private(devinfo);
1298 if (Adapter == NULL)
1299 e1000g_log(Adapter, CE_PANIC,
1302 if (Adapter->dip != devinfo)
1303 e1000g_log(Adapter, CE_PANIC,
1306 rw_enter(&Adapter->chip_lock, RW_WRITER);
1308 if (Adapter->e1000g_state & E1000G_STARTED) {
1309 if (e1000g_start(Adapter, B_FALSE) != DDI_SUCCESS) {
1310 rw_exit(&Adapter->chip_lock);
1315 e1000g_log(Adapter, CE_WARN,
1320 enable_watchdog_timer(Adapter);
1323 Adapter->e1000g_state &= ~E1000G_SUSPENDED;
1325 rw_exit(&Adapter->chip_lock);
1333 struct e1000g *Adapter;
1335 Adapter = (struct e1000g *)ddi_get_driver_private(devinfo);
1336 if (Adapter == NULL)
1339 rw_enter(&Adapter->chip_lock, RW_WRITER);
1341 Adapter->e1000g_state |= E1000G_SUSPENDED;
1344 if (!(Adapter->e1000g_state & E1000G_STARTED)) {
1345 rw_exit(&Adapter->chip_lock);
1349 e1000g_stop(Adapter, B_FALSE);
1351 rw_exit(&Adapter->chip_lock);
1354 disable_watchdog_timer(Adapter);
1355 stop_link_timer(Adapter);
1356 stop_82547_timer(Adapter->tx_ring);
1362 e1000g_init(struct e1000g *Adapter)
1370 hw = &Adapter->shared;
1381 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1398 e1000g_log(Adapter, CE_WARN,
1401 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1411 result = e1000g_find_mac_address(Adapter);
1421 e1000g_log(Adapter, CE_WARN, "Read mac addr failed");
1422 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1428 e1000g_log(Adapter, CE_WARN, "Invalid mac addr");
1429 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1437 if (Adapter->master_latency_timer) {
1438 pci_config_put8(Adapter->osdep.cfg_handle,
1439 PCI_CONF_LATENCY_TIMER, Adapter->master_latency_timer);
1446 if (Adapter->max_frame_size > FRAME_SIZE_UPTO_8K)
1456 if (Adapter->max_frame_size > FRAME_SIZE_UPTO_8K)
1483 if (Adapter->max_frame_size > FRAME_SIZE_UPTO_8K)
1508 ((pba << 10) - Adapter->max_frame_size)));
1527 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1551 e1000g_log(Adapter, CE_WARN, "Initialize hw failed");
1552 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1571 e1000g_init_unicst(Adapter);
1578 (uint8_t *)Adapter->mcast_table, Adapter->mcast_count);
1588 E1000_WRITE_REG(hw, E1000_ITR, Adapter->intr_throttling_rate);
1590 Adapter->intr_adaptive = B_FALSE;
1598 mutex_enter(&Adapter->link_lock);
1600 Adapter->link_complete = B_TRUE;
1602 Adapter->link_complete = B_FALSE;
1603 Adapter->link_tid = timeout(e1000g_link_timer,
1604 (void *)Adapter, link_timeout);
1606 mutex_exit(&Adapter->link_lock);
1609 e1000g_get_phy_state(Adapter);
1611 e1000g_param_sync(Adapter);
1613 Adapter->init_count++;
1615 if (e1000g_check_acc_handle(Adapter->osdep.cfg_handle) != DDI_FM_OK) {
1618 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
1622 Adapter->poll_mode = e1000g_poll_mode;
1627 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
1632 e1000g_alloc_rx_data(struct e1000g *Adapter)
1637 rx_ring = Adapter->rx_ring;
1644 rx_data->priv_devi_node = Adapter->priv_devi_node;
1648 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1650 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1690 e1000g_link_up(struct e1000g *Adapter)
1692 struct e1000_hw *hw = &Adapter->shared;
1876 struct e1000g *Adapter = (struct e1000g *)arg;
1878 rw_enter(&Adapter->chip_lock, RW_WRITER);
1880 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
1881 rw_exit(&Adapter->chip_lock);
1885 if (e1000g_start(Adapter, B_TRUE) != DDI_SUCCESS) {
1886 rw_exit(&Adapter->chip_lock);
1890 Adapter->e1000g_state |= E1000G_STARTED;
1892 rw_exit(&Adapter->chip_lock);
1895 enable_watchdog_timer(Adapter);
1901 e1000g_start(struct e1000g *Adapter, boolean_t global)
1906 if (e1000g_alloc_rx_data(Adapter) != DDI_SUCCESS) {
1907 e1000g_log(Adapter, CE_WARN, "Allocate rx data failed");
1912 if (e1000g_alloc_dma_resources(Adapter) != DDI_SUCCESS) {
1913 e1000g_log(Adapter, CE_WARN,
1917 Adapter->rx_buffer_setup = B_FALSE;
1920 if (!(Adapter->attach_progress & ATTACH_PROGRESS_INIT)) {
1921 if (e1000g_init(Adapter) != DDI_SUCCESS) {
1922 e1000g_log(Adapter, CE_WARN,
1923 "Adapter initialization failed");
1929 e1000g_tx_setup(Adapter);
1933 e1000g_rx_setup(Adapter);
1937 e1000g_restore_promisc(Adapter);
1939 e1000g_mask_interrupt(Adapter);
1941 Adapter->attach_progress |= ATTACH_PROGRESS_INIT;
1943 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
1944 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
1951 rx_data = Adapter->rx_ring->rx_data;
1954 e1000g_release_dma_resources(Adapter);
1960 (void) e1000_reset_hw(&Adapter->shared);
1974 e1000g_flush_desc_rings(struct e1000g *Adapter)
1976 struct e1000_hw *hw = &Adapter->shared;
1987 hang_state = pci_config_get16(Adapter->osdep.cfg_handle,
1991 e1000g_flush_tx_ring(Adapter);
1994 hang_state = pci_config_get16(Adapter->osdep.cfg_handle,
1997 e1000g_flush_rx_ring(Adapter);
2004 struct e1000g *Adapter = (struct e1000g *)arg;
2007 (void) e1000g_tx_drain(Adapter);
2009 rw_enter(&Adapter->chip_lock, RW_WRITER);
2011 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
2012 rw_exit(&Adapter->chip_lock);
2015 Adapter->e1000g_state &= ~E1000G_STARTED;
2016 e1000g_stop(Adapter, B_TRUE);
2018 rw_exit(&Adapter->chip_lock);
2021 disable_watchdog_timer(Adapter);
2022 stop_link_timer(Adapter);
2023 stop_82547_timer(Adapter->tx_ring);
2027 e1000g_stop(struct e1000g *Adapter, boolean_t global)
2033 Adapter->attach_progress &= ~ATTACH_PROGRESS_INIT;
2038 e1000g_release_driver_control(&Adapter->shared);
2040 e1000g_clear_all_interrupts(Adapter);
2043 result = e1000_reset_hw(&Adapter->shared);
2047 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
2048 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
2051 mutex_enter(&Adapter->link_lock);
2052 Adapter->link_complete = B_FALSE;
2053 mutex_exit(&Adapter->link_lock);
2056 e1000g_tx_clean(Adapter);
2058 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK)
2059 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
2062 e1000g_rx_clean(Adapter);
2069 if (Adapter->shared.mac.type == e1000_pch_spt)
2070 e1000g_flush_desc_rings(Adapter);
2073 e1000g_release_dma_resources(Adapter);
2076 rx_data = Adapter->rx_ring->rx_data;
2087 atomic_inc_32(&Adapter->pending_rx_count);
2092 if (Adapter->link_state != LINK_STATE_UNKNOWN) {
2093 Adapter->link_state = LINK_STATE_UNKNOWN;
2094 if (!Adapter->reset_flag)
2095 mac_link_update(Adapter->mh, Adapter->link_state);
2100 e1000g_rx_clean(struct e1000g *Adapter)
2102 e1000g_rx_data_t *rx_data = Adapter->rx_ring->rx_data;
2116 e1000g_tx_clean(struct e1000g *Adapter)
2124 tx_ring = Adapter->tx_ring;
2168 E1000_WRITE_REG(&Adapter->shared, E1000_TDH(0), 0);
2169 E1000_WRITE_REG(&Adapter->shared, E1000_TDT(0), 0);
2174 e1000g_tx_drain(struct e1000g *Adapter)
2180 tx_ring = Adapter->tx_ring;
2198 e1000g_rx_drain(struct e1000g *Adapter)
2207 done = (Adapter->pending_rx_count == 0);
2219 e1000g_reset_adapter(struct e1000g *Adapter)
2222 disable_watchdog_timer(Adapter);
2223 stop_link_timer(Adapter);
2224 stop_82547_timer(Adapter->tx_ring);
2226 rw_enter(&Adapter->chip_lock, RW_WRITER);
2228 if (Adapter->stall_flag) {
2229 Adapter->stall_flag = B_FALSE;
2230 Adapter->reset_flag = B_TRUE;
2233 if (!(Adapter->e1000g_state & E1000G_STARTED)) {
2234 rw_exit(&Adapter->chip_lock);
2238 e1000g_stop(Adapter, B_FALSE);
2240 if (e1000g_start(Adapter, B_FALSE) != DDI_SUCCESS) {
2241 rw_exit(&Adapter->chip_lock);
2242 e1000g_log(Adapter, CE_WARN, "Reset failed");
2246 rw_exit(&Adapter->chip_lock);
2249 enable_watchdog_timer(Adapter);
2255 e1000g_global_reset(struct e1000g *Adapter)
2258 disable_watchdog_timer(Adapter);
2259 stop_link_timer(Adapter);
2260 stop_82547_timer(Adapter->tx_ring);
2262 rw_enter(&Adapter->chip_lock, RW_WRITER);
2264 e1000g_stop(Adapter, B_TRUE);
2266 Adapter->init_count = 0;
2268 if (e1000g_start(Adapter, B_TRUE) != DDI_SUCCESS) {
2269 rw_exit(&Adapter->chip_lock);
2270 e1000g_log(Adapter, CE_WARN, "Reset failed");
2274 rw_exit(&Adapter->chip_lock);
2277 enable_watchdog_timer(Adapter);
2292 struct e1000g *Adapter;
2295 Adapter = (struct e1000g *)(uintptr_t)arg;
2296 icr = E1000_READ_REG(&Adapter->shared, E1000_ICR);
2298 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2299 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2309 e1000g_intr_work(Adapter, icr);
2330 struct e1000g *Adapter;
2333 Adapter = (struct e1000g *)(uintptr_t)arg;
2334 icr = E1000_READ_REG(&Adapter->shared, E1000_ICR);
2336 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2337 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2347 e1000g_intr_work(Adapter, icr);
2365 e1000g_intr_work(struct e1000g *Adapter, uint32_t icr)
2368 hw = &Adapter->shared;
2369 e1000g_tx_ring_t *tx_ring = Adapter->tx_ring;
2371 Adapter->rx_pkt_cnt = 0;
2372 Adapter->tx_pkt_cnt = 0;
2374 rw_enter(&Adapter->chip_lock, RW_READER);
2376 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
2377 rw_exit(&Adapter->chip_lock);
2385 if (!(Adapter->e1000g_state & E1000G_STARTED)) {
2386 rw_exit(&Adapter->chip_lock);
2395 rx_ring = Adapter->rx_ring;
2407 rw_exit(&Adapter->chip_lock);
2409 mac_rx_ring(Adapter->mh, rx_ring->mrh,
2412 rw_exit(&Adapter->chip_lock);
2415 if (!Adapter->tx_intr_enable)
2416 e1000g_clear_tx_interrupt(Adapter);
2419 rw_enter(&Adapter->chip_lock, RW_READER);
2422 rw_exit(&Adapter->chip_lock);
2427 mac_tx_update(Adapter->mh);
2444 stop_watchdog_timer(Adapter);
2446 rw_enter(&Adapter->chip_lock, RW_WRITER);
2452 Adapter->shared.mac.get_link_status = B_TRUE;
2455 link_changed = e1000g_link_check(Adapter);
2458 e1000g_get_phy_state(Adapter);
2464 if (link_changed && !Adapter->link_complete) {
2465 if (Adapter->link_state == LINK_STATE_UP) {
2466 mutex_enter(&Adapter->link_lock);
2467 Adapter->link_complete = B_TRUE;
2468 tid = Adapter->link_tid;
2469 Adapter->link_tid = 0;
2470 mutex_exit(&Adapter->link_lock);
2475 rw_exit(&Adapter->chip_lock);
2485 if ((Adapter->link_state == LINK_STATE_DOWN) &&
2486 (Adapter->shared.mac.type == e1000_80003es2lan)) {
2490 e1000g_log(Adapter, CE_WARN,
2492 Adapter->esb2_workaround = B_TRUE;
2494 if (!Adapter->reset_flag)
2495 mac_link_update(Adapter->mh,
2496 Adapter->link_state);
2497 if (Adapter->link_state == LINK_STATE_UP)
2498 Adapter->reset_flag = B_FALSE;
2501 start_watchdog_timer(Adapter);
2506 e1000g_init_unicst(struct e1000g *Adapter)
2511 hw = &Adapter->shared;
2513 if (Adapter->init_count == 0) {
2515 Adapter->unicst_total = min(hw->mac.rar_entry_count,
2543 Adapter->unicst_total = min(rar,
2550 Adapter->unicst_total--;
2554 Adapter->unicst_total = 1;
2556 Adapter->unicst_avail = Adapter->unicst_total;
2558 for (slot = 0; slot < Adapter->unicst_total; slot++) {
2560 Adapter->unicst_addr[slot].reg.high = 0;
2561 Adapter->unicst_addr[slot].reg.low = 0;
2570 for (slot = 0; slot < Adapter->unicst_total; slot++)
2571 if (Adapter->unicst_addr[slot].mac.set == 1)
2573 Adapter->unicst_addr[slot].mac.addr, slot);
2576 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK)
2577 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2581 e1000g_unicst_set(struct e1000g *Adapter, const uint8_t *mac_addr,
2586 hw = &Adapter->shared;
2609 Adapter->unicst_addr[slot].reg.high = 0;
2610 Adapter->unicst_addr[slot].reg.low = 0;
2612 bcopy(mac_addr, Adapter->unicst_addr[slot].mac.addr,
2615 Adapter->unicst_addr[slot].mac.set = 1;
2647 e1000g_rx_setup(Adapter);
2650 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2651 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2659 multicst_add(struct e1000g *Adapter, const uint8_t *multiaddr)
2661 struct e1000_hw *hw = &Adapter->shared;
2669 e1000g_log(Adapter, CE_WARN, "Illegal multicast address");
2673 if (Adapter->mcast_count >= Adapter->mcast_max_num) {
2675 e1000g_log(Adapter, CE_WARN,
2676 "Adapter requested more than %d mcast addresses",
2677 Adapter->mcast_max_num);
2682 if (Adapter->mcast_count == Adapter->mcast_alloc_count) {
2683 old_len = Adapter->mcast_alloc_count *
2685 new_len = (Adapter->mcast_alloc_count + MCAST_ALLOC_SIZE) *
2691 e1000g_log(Adapter, CE_WARN,
2696 if (Adapter->mcast_table != NULL) {
2697 bcopy(Adapter->mcast_table, newtable, old_len);
2698 kmem_free(Adapter->mcast_table, old_len);
2700 Adapter->mcast_alloc_count += MCAST_ALLOC_SIZE;
2701 Adapter->mcast_table = newtable;
2705 &Adapter->mcast_table[Adapter->mcast_count], ETHERADDRL);
2706 Adapter->mcast_count++;
2711 e1000g_clear_interrupt(Adapter);
2714 (uint8_t *)Adapter->mcast_table, Adapter->mcast_count);
2716 e1000g_mask_interrupt(Adapter);
2718 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2719 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2728 multicst_remove(struct e1000g *Adapter, const uint8_t *multiaddr)
2730 struct e1000_hw *hw = &Adapter->shared;
2736 for (i = 0; i < Adapter->mcast_count; i++) {
2737 if (bcmp(multiaddr, &Adapter->mcast_table[i],
2739 for (i++; i < Adapter->mcast_count; i++) {
2740 Adapter->mcast_table[i - 1] =
2741 Adapter->mcast_table[i];
2743 Adapter->mcast_count--;
2748 if ((Adapter->mcast_alloc_count - Adapter->mcast_count) >
2750 old_len = Adapter->mcast_alloc_count *
2752 new_len = (Adapter->mcast_alloc_count - MCAST_ALLOC_SIZE) *
2757 bcopy(Adapter->mcast_table, newtable, new_len);
2758 kmem_free(Adapter->mcast_table, old_len);
2760 Adapter->mcast_alloc_count -= MCAST_ALLOC_SIZE;
2761 Adapter->mcast_table = newtable;
2768 e1000g_clear_interrupt(Adapter);
2771 (uint8_t *)Adapter->mcast_table, Adapter->mcast_count);
2773 e1000g_mask_interrupt(Adapter);
2775 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2776 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2784 e1000g_release_multicast(struct e1000g *Adapter)
2786 if (Adapter->mcast_table != NULL) {
2787 kmem_free(Adapter->mcast_table,
2788 Adapter->mcast_alloc_count * sizeof (struct ether_addr));
2789 Adapter->mcast_table = NULL;
2796 struct e1000g *Adapter = (struct e1000g *)arg;
2799 rw_enter(&Adapter->chip_lock, RW_WRITER);
2801 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
2806 result = (add) ? multicst_add(Adapter, addr)
2807 : multicst_remove(Adapter, addr);
2810 rw_exit(&Adapter->chip_lock);
2818 struct e1000g *Adapter = (struct e1000g *)arg;
2821 rw_enter(&Adapter->chip_lock, RW_WRITER);
2823 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
2824 rw_exit(&Adapter->chip_lock);
2828 rctl = E1000_READ_REG(&Adapter->shared, E1000_RCTL);
2836 E1000_WRITE_REG(&Adapter->shared, E1000_RCTL, rctl);
2838 Adapter->e1000g_promisc = on;
2840 rw_exit(&Adapter->chip_lock);
2842 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2843 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2963 e1000g_unicst_find(struct e1000g *Adapter, const uint8_t *mac_addr)
2967 for (slot = 0; slot < Adapter->unicst_total; slot++) {
2968 if ((Adapter->unicst_addr[slot].mac.set == 1) &&
2969 (bcmp(Adapter->unicst_addr[slot].mac.addr,
2986 struct e1000g *Adapter = (struct e1000g *)arg;
2989 rw_enter(&Adapter->chip_lock, RW_WRITER);
2991 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
2992 rw_exit(&Adapter->chip_lock);
2996 if (e1000g_unicst_find(Adapter, mac_addr) != -1) {
2998 rw_exit(&Adapter->chip_lock);
3002 if (Adapter->unicst_avail == 0) {
3004 rw_exit(&Adapter->chip_lock);
3009 for (slot = 0; slot < Adapter->unicst_total; slot++) {
3010 if (Adapter->unicst_addr[slot].mac.set == 0)
3013 ASSERT(slot < Adapter->unicst_total);
3015 err = e1000g_unicst_set(Adapter, mac_addr, slot);
3017 Adapter->unicst_avail--;
3019 rw_exit(&Adapter->chip_lock);
3027 struct e1000g *Adapter = (struct e1000g *)arg;
3030 rw_enter(&Adapter->chip_lock, RW_WRITER);
3032 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
3033 rw_exit(&Adapter->chip_lock);
3037 slot = e1000g_unicst_find(Adapter, mac_addr);
3039 rw_exit(&Adapter->chip_lock);
3043 ASSERT(Adapter->unicst_addr[slot].mac.set);
3046 err = e1000g_unicst_set(Adapter, NULL, slot);
3048 Adapter->unicst_avail++;
3050 rw_exit(&Adapter->chip_lock);
3079 struct e1000g *Adapter = (struct e1000g *)arg;
3080 e1000g_rx_ring_t *rx_ring = Adapter->rx_ring;
3101 if (Adapter->msi_enable)
3102 mintr->mi_ddi_handle = Adapter->htable[0];
3110 struct e1000g *Adapter = (struct e1000g *)arg;
3119 Adapter->rx_group = gh;
3121 infop->mgi_driver = (mac_group_driver_t)Adapter;
3130 mintr->mi_handle = (mac_intr_handle_t)Adapter;
3138 struct e1000g *Adapter = (struct e1000g *)arg;
3144 if (Adapter->tx_hcksum_enable)
3155 if (Adapter->lso_enable) {
3211 struct e1000g *Adapter = arg;
3212 struct e1000_hw *hw = &Adapter->shared;
3213 struct e1000_fc_info *fc = &Adapter->shared.fc;
3218 rw_enter(&Adapter->chip_lock, RW_WRITER);
3220 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
3221 rw_exit(&Adapter->chip_lock);
3225 if (Adapter->loopback_mode != E1000G_LB_NONE &&
3231 rw_exit(&Adapter->chip_lock);
3241 Adapter->param_en_1000fdx = *(uint8_t *)pr_val;
3242 Adapter->param_adv_1000fdx = *(uint8_t *)pr_val;
3249 Adapter->param_en_100fdx = *(uint8_t *)pr_val;
3250 Adapter->param_adv_100fdx = *(uint8_t *)pr_val;
3257 Adapter->param_en_100hdx = *(uint8_t *)pr_val;
3258 Adapter->param_adv_100hdx = *(uint8_t *)pr_val;
3265 Adapter->param_en_10fdx = *(uint8_t *)pr_val;
3266 Adapter->param_adv_10fdx = *(uint8_t *)pr_val;
3273 Adapter->param_en_10hdx = *(uint8_t *)pr_val;
3274 Adapter->param_adv_10hdx = *(uint8_t *)pr_val;
3281 Adapter->param_adv_autoneg = *(uint8_t *)pr_val;
3307 e1000g_pch_limits(Adapter);
3308 if (e1000g_reset_link(Adapter) != DDI_SUCCESS)
3326 if (Adapter->e1000g_state & E1000G_STARTED) {
3331 cur_mtu = Adapter->default_mtu;
3341 (new_mtu > Adapter->max_mtu)) {
3347 err = mac_maxsdu_update(Adapter->mh, new_mtu);
3350 Adapter->default_mtu = new_mtu;
3351 Adapter->max_frame_size =
3358 e1000g_pch_limits(Adapter);
3359 e1000g_set_bufsize(Adapter);
3366 if (Adapter->max_frame_size >=
3368 if (Adapter->tx_desc_num_flag == 0)
3369 Adapter->tx_desc_num =
3372 if (Adapter->rx_desc_num_flag == 0)
3373 Adapter->rx_desc_num =
3376 if (Adapter->tx_buf_num_flag == 0)
3377 Adapter->tx_freelist_num =
3380 if (Adapter->rx_buf_num_flag == 0)
3381 Adapter->rx_freelist_limit =
3384 if (Adapter->tx_desc_num_flag == 0)
3385 Adapter->tx_desc_num =
3388 if (Adapter->rx_desc_num_flag == 0)
3389 Adapter->rx_desc_num =
3392 if (Adapter->tx_buf_num_flag == 0)
3393 Adapter->tx_freelist_num =
3396 if (Adapter->rx_buf_num_flag == 0)
3397 Adapter->rx_freelist_limit =
3403 err = e1000g_set_priv_prop(Adapter, pr_name,
3410 rw_exit(&Adapter->chip_lock);
3418 struct e1000g *Adapter = arg;
3419 struct e1000_fc_info *fc = &Adapter->shared.fc;
3427 bcopy(&Adapter->link_duplex, pr_val,
3432 tmp = Adapter->link_speed * 1000000ull;
3436 *(uint8_t *)pr_val = Adapter->param_adv_autoneg;
3457 *(uint8_t *)pr_val = Adapter->param_adv_1000fdx;
3460 *(uint8_t *)pr_val = Adapter->param_en_1000fdx;
3463 *(uint8_t *)pr_val = Adapter->param_adv_1000hdx;
3466 *(uint8_t *)pr_val = Adapter->param_en_1000hdx;
3469 *(uint8_t *)pr_val = Adapter->param_adv_100fdx;
3472 *(uint8_t *)pr_val = Adapter->param_en_100fdx;
3475 *(uint8_t *)pr_val = Adapter->param_adv_100hdx;
3478 *(uint8_t *)pr_val = Adapter->param_en_100hdx;
3481 *(uint8_t *)pr_val = Adapter->param_adv_10fdx;
3484 *(uint8_t *)pr_val = Adapter->param_en_10fdx;
3487 *(uint8_t *)pr_val = Adapter->param_adv_10hdx;
3490 *(uint8_t *)pr_val = Adapter->param_en_10hdx;
3494 *(uint8_t *)pr_val = Adapter->param_adv_100t4;
3497 err = e1000g_get_priv_prop(Adapter, pr_name,
3512 struct e1000g *Adapter = arg;
3513 struct e1000_hw *hw = &Adapter->shared;
3534 ((Adapter->phy_ext_status &
3536 (Adapter->phy_ext_status &
3546 ((Adapter->phy_status & MII_SR_100X_FD_CAPS) ||
3547 (Adapter->phy_status & MII_SR_100T2_FD_CAPS))
3557 ((Adapter->phy_status & MII_SR_100X_HD_CAPS) ||
3558 (Adapter->phy_status & MII_SR_100T2_HD_CAPS))
3568 (Adapter->phy_status & MII_SR_10T_FD_CAPS) ? 1 : 0);
3577 (Adapter->phy_status & MII_SR_10T_HD_CAPS) ? 1 : 0);
3591 (Adapter->phy_status & MII_SR_AUTONEG_CAPS)
3601 struct e1000_mac_info *mac = &Adapter->shared.mac;
3602 struct e1000_phy_info *phy = &Adapter->shared.phy;
3611 max = Adapter->max_mtu;
3658 e1000g_set_priv_prop(struct e1000g *Adapter, const char *pr_name,
3663 struct e1000_hw *hw = &Adapter->shared;
3675 Adapter->tx_bcopy_thresh = (uint32_t)result;
3688 Adapter->tx_intr_enable = (result == 1) ?
3690 if (Adapter->tx_intr_enable)
3691 e1000g_mask_tx_interrupt(Adapter);
3693 e1000g_clear_tx_interrupt(Adapter);
3695 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3696 ddi_fm_service_impact(Adapter->dip,
3713 Adapter->tx_intr_delay = (uint32_t)result;
3714 E1000_WRITE_REG(hw, E1000_TIDV, Adapter->tx_intr_delay);
3716 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3717 ddi_fm_service_impact(Adapter->dip,
3734 Adapter->tx_intr_abs_delay = (uint32_t)result;
3736 Adapter->tx_intr_abs_delay);
3738 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3739 ddi_fm_service_impact(Adapter->dip,
3756 Adapter->rx_bcopy_thresh = (uint32_t)result;
3769 Adapter->rx_limit_onintr = (uint32_t)result;
3782 Adapter->rx_intr_delay = (uint32_t)result;
3783 E1000_WRITE_REG(hw, E1000_RDTR, Adapter->rx_intr_delay);
3785 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3786 ddi_fm_service_impact(Adapter->dip,
3803 Adapter->rx_intr_abs_delay = (uint32_t)result;
3805 Adapter->rx_intr_abs_delay);
3807 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3808 ddi_fm_service_impact(Adapter->dip,
3826 Adapter->intr_throttling_rate =
3829 Adapter->intr_throttling_rate);
3831 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3832 ddi_fm_service_impact(Adapter->dip,
3851 Adapter->intr_adaptive = (result == 1) ?
3863 e1000g_get_priv_prop(struct e1000g *Adapter, const char *pr_name,
3870 value = Adapter->param_adv_pause;
3875 value = Adapter->param_adv_asym_pause;
3880 value = Adapter->tx_bcopy_thresh;
3885 value = Adapter->tx_intr_enable;
3890 value = Adapter->tx_intr_delay;
3895 value = Adapter->tx_intr_abs_delay;
3900 value = Adapter->rx_bcopy_thresh;
3905 value = Adapter->rx_limit_onintr;
3910 value = Adapter->rx_intr_delay;
3915 value = Adapter->rx_intr_abs_delay;
3920 value = Adapter->intr_throttling_rate;
3925 value = Adapter->intr_adaptive;
3948 e1000g_get_conf(struct e1000g *Adapter)
3950 struct e1000_hw *hw = &Adapter->shared;
3958 if (Adapter->max_frame_size >= FRAME_SIZE_UPTO_4K) {
3969 Adapter->tx_desc_num_flag =
3970 e1000g_get_prop(Adapter, "NumTxDescriptors",
3974 Adapter->tx_desc_num = propval;
3979 Adapter->rx_desc_num_flag =
3980 e1000g_get_prop(Adapter, "NumRxDescriptors",
3984 Adapter->rx_desc_num = propval;
3989 Adapter->rx_buf_num_flag =
3990 e1000g_get_prop(Adapter, "NumRxFreeList",
3994 Adapter->rx_freelist_limit = propval;
3999 Adapter->tx_buf_num_flag =
4000 e1000g_get_prop(Adapter, "NumTxPacketList",
4004 Adapter->tx_freelist_num = propval;
4010 (void) e1000g_get_prop(Adapter, "FlowControl",
4020 (void) e1000g_get_prop(Adapter, "MaxNumReceivePackets",
4023 Adapter->rx_limit_onintr = propval;
4028 (void) e1000g_get_prop(Adapter, "SetMasterSlave",
4037 (void) e1000g_get_prop(Adapter, "TbiCompatibilityEnable",
4045 (void) e1000g_get_prop(Adapter, "MSIEnable",
4047 Adapter->msi_enable = (propval == 1);
4052 (void) e1000g_get_prop(Adapter, "intr_throttling_rate",
4055 Adapter->intr_throttling_rate = propval;
4061 (void) e1000g_get_prop(Adapter, "intr_adaptive", 0, 1, 1,
4063 Adapter->intr_adaptive = (propval == 1);
4068 (void) e1000g_get_prop(Adapter, "tx_hcksum_enable",
4070 Adapter->tx_hcksum_enable = (propval == 1);
4108 Adapter->tx_hcksum_enable = B_FALSE;
4116 (void) e1000g_get_prop(Adapter, "lso_enable",
4118 Adapter->lso_enable = (propval == 1);
4123 if (Adapter->lso_enable)
4124 Adapter->lso_premature_issue = B_TRUE;
4132 Adapter->lso_enable = B_FALSE;
4135 if (!Adapter->tx_hcksum_enable) {
4136 Adapter->lso_premature_issue = B_FALSE;
4137 Adapter->lso_enable = B_FALSE;
4145 (void) e1000g_get_prop(Adapter, "mem_workaround_82546",
4147 Adapter->mem_workaround_82546 = (propval == 1);
4152 (void) e1000g_get_prop(Adapter, "mcast_max_num",
4155 Adapter->mcast_max_num = propval;
4172 e1000g_get_prop(struct e1000g *Adapter, /* point to per-adapter structure */
4187 if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, Adapter->dip,
4190 if (Adapter->instance < nprops) {
4191 propval = props[Adapter->instance];
4195 E1000G_DEBUGLOG_2(Adapter, E1000G_INFO_LEVEL,
4215 E1000G_DEBUGLOG_2(Adapter, E1000G_INFO_LEVEL,
4222 E1000G_DEBUGLOG_2(Adapter, E1000G_INFO_LEVEL,
4232 e1000g_link_check(struct e1000g *Adapter)
4239 hw = &Adapter->shared;
4241 if (e1000g_link_up(Adapter)) {
4245 if (Adapter->link_state != LINK_STATE_UP) {
4247 Adapter->link_speed = speed;
4248 Adapter->link_duplex = duplex;
4249 Adapter->link_state = LINK_STATE_UP;
4252 if (Adapter->link_speed == SPEED_1000)
4253 Adapter->stall_threshold = TX_STALL_TIME_2S;
4255 Adapter->stall_threshold = TX_STALL_TIME_8S;
4257 Adapter->tx_link_down_timeout = 0;
4269 Adapter->smartspeed = 0;
4271 if (Adapter->link_state != LINK_STATE_DOWN) {
4272 Adapter->link_speed = 0;
4273 Adapter->link_duplex = 0;
4274 Adapter->link_state = LINK_STATE_DOWN;
4290 e1000g_smartspeed(Adapter);
4293 if (Adapter->e1000g_state & E1000G_STARTED) {
4294 if (Adapter->tx_link_down_timeout <
4296 Adapter->tx_link_down_timeout++;
4297 } else if (Adapter->tx_link_down_timeout ==
4299 e1000g_tx_clean(Adapter);
4300 Adapter->tx_link_down_timeout++;
4305 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK)
4306 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
4315 e1000g_reset_link(struct e1000g *Adapter)
4322 mac = &Adapter->shared.mac;
4323 phy = &Adapter->shared.phy;
4324 hw = &Adapter->shared;
4330 if (Adapter->param_adv_autoneg == 1) {
4337 if (Adapter->param_adv_1000fdx == 1)
4340 if (Adapter->param_adv_100fdx == 1)
4343 if (Adapter->param_adv_100hdx == 1)
4346 if (Adapter->param_adv_10fdx == 1)
4349 if (Adapter->param_adv_10hdx == 1)
4361 if (Adapter->param_adv_100fdx == 1)
4363 else if (Adapter->param_adv_100hdx == 1)
4365 else if (Adapter->param_adv_10fdx == 1)
4367 else if (Adapter->param_adv_10hdx == 1)
4375 e1000g_log(Adapter, CE_WARN,
4383 return (e1000_setup_link(&Adapter->shared));
4387 e1000g_timer_tx_resched(struct e1000g *Adapter)
4389 e1000g_tx_ring_t *tx_ring = Adapter->tx_ring;
4391 rw_enter(&Adapter->chip_lock, RW_READER);
4396 (Adapter->e1000g_state & E1000G_STARTED) &&
4399 mac_tx_update(Adapter->mh);
4404 rw_exit(&Adapter->chip_lock);
4410 struct e1000g *Adapter = (struct e1000g *)ws;
4415 hw = &Adapter->shared;
4417 if (Adapter->e1000g_state & E1000G_ERROR) {
4418 rw_enter(&Adapter->chip_lock, RW_WRITER);
4419 Adapter->e1000g_state &= ~E1000G_ERROR;
4420 rw_exit(&Adapter->chip_lock);
4422 Adapter->reset_count++;
4423 if (e1000g_global_reset(Adapter)) {
4424 ddi_fm_service_impact(Adapter->dip,
4426 e1000g_timer_tx_resched(Adapter);
4428 ddi_fm_service_impact(Adapter->dip,
4433 if (e1000g_stall_check(Adapter)) {
4434 E1000G_DEBUGLOG_0(Adapter, E1000G_INFO_LEVEL,
4436 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_STALL);
4437 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
4438 Adapter->reset_count++;
4439 if (e1000g_reset_adapter(Adapter)) {
4440 ddi_fm_service_impact(Adapter->dip,
4442 e1000g_timer_tx_resched(Adapter);
4448 rw_enter(&Adapter->chip_lock, RW_READER);
4449 if (Adapter->link_complete)
4450 link_changed = e1000g_link_check(Adapter);
4451 rw_exit(&Adapter->chip_lock);
4454 if (!Adapter->reset_flag &&
4455 (Adapter->e1000g_state & E1000G_STARTED) &&
4456 !(Adapter->e1000g_state & E1000G_SUSPENDED))
4457 mac_link_update(Adapter->mh, Adapter->link_state);
4458 if (Adapter->link_state == LINK_STATE_UP)
4459 Adapter->reset_flag = B_FALSE;
4465 if (Adapter->esb2_workaround) {
4466 Adapter->esb2_workaround = B_FALSE;
4467 (void) e1000g_reset_adapter(Adapter);
4505 ((Adapter->link_speed == SPEED_100) ||
4506 (Adapter->link_speed == SPEED_10))) {
4514 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK)
4515 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
4517 e1000g_timer_tx_resched(Adapter);
4519 restart_watchdog_timer(Adapter);
4533 struct e1000g *Adapter = (struct e1000g *)arg;
4535 mutex_enter(&Adapter->link_lock);
4536 Adapter->link_complete = B_TRUE;
4537 Adapter->link_tid = 0;
4538 mutex_exit(&Adapter->link_lock);
4548 e1000g_force_speed_duplex(struct e1000g *Adapter)
4552 struct e1000_mac_info *mac = &Adapter->shared.mac;
4553 struct e1000_phy_info *phy = &Adapter->shared.phy;
4558 (void) e1000g_get_prop(Adapter, "ForceSpeedDuplex",
4603 (void) e1000g_get_prop(Adapter, "AutoNegAdvertised",
4617 e1000g_get_max_frame_size(struct e1000g *Adapter)
4624 (void) e1000g_get_prop(Adapter, "MaxFrameSize", 0, 3, 0,
4629 Adapter->default_mtu = ETHERMTU;
4632 Adapter->default_mtu = FRAME_SIZE_UPTO_4K -
4636 Adapter->default_mtu = FRAME_SIZE_UPTO_8K -
4640 Adapter->default_mtu = FRAME_SIZE_UPTO_16K -
4644 Adapter->default_mtu = ETHERMTU;
4652 if (Adapter->default_mtu > Adapter->max_mtu)
4653 Adapter->default_mtu = Adapter->max_mtu;
4655 Adapter->max_frame_size = e1000g_mtu2maxframe(Adapter->default_mtu);
4665 e1000g_pch_limits(struct e1000g *Adapter)
4667 struct e1000_hw *hw = &Adapter->shared;
4674 if (Adapter->max_frame_size > DEFAULT_FRAME_SIZE) {
4678 Adapter->param_adv_autoneg = 1;
4679 Adapter->param_adv_1000fdx = 1;
4681 Adapter->param_adv_100fdx = 0;
4682 Adapter->param_adv_100hdx = 0;
4683 Adapter->param_adv_10fdx = 0;
4684 Adapter->param_adv_10hdx = 0;
4686 e1000g_param_sync(Adapter);
4704 arm_watchdog_timer(struct e1000g *Adapter)
4706 Adapter->watchdog_tid =
4708 (void *)Adapter, 1 * drv_usectohz(1000000));
4713 enable_watchdog_timer(struct e1000g *Adapter)
4715 mutex_enter(&Adapter->watchdog_lock);
4717 if (!Adapter->watchdog_timer_enabled) {
4718 Adapter->watchdog_timer_enabled = B_TRUE;
4719 Adapter->watchdog_timer_started = B_TRUE;
4720 arm_watchdog_timer(Adapter);
4723 mutex_exit(&Adapter->watchdog_lock);
4727 disable_watchdog_timer(struct e1000g *Adapter)
4731 mutex_enter(&Adapter->watchdog_lock);
4733 Adapter->watchdog_timer_enabled = B_FALSE;
4734 Adapter->watchdog_timer_started = B_FALSE;
4735 tid = Adapter->watchdog_tid;
4736 Adapter->watchdog_tid = 0;
4738 mutex_exit(&Adapter->watchdog_lock);
4745 start_watchdog_timer(struct e1000g *Adapter)
4747 mutex_enter(&Adapter->watchdog_lock);
4749 if (Adapter->watchdog_timer_enabled) {
4750 if (!Adapter->watchdog_timer_started) {
4751 Adapter->watchdog_timer_started = B_TRUE;
4752 arm_watchdog_timer(Adapter);
4756 mutex_exit(&Adapter->watchdog_lock);
4760 restart_watchdog_timer(struct e1000g *Adapter)
4762 mutex_enter(&Adapter->watchdog_lock);
4764 if (Adapter->watchdog_timer_started)
4765 arm_watchdog_timer(Adapter);
4767 mutex_exit(&Adapter->watchdog_lock);
4771 stop_watchdog_timer(struct e1000g *Adapter)
4775 mutex_enter(&Adapter->watchdog_lock);
4777 Adapter->watchdog_timer_started = B_FALSE;
4778 tid = Adapter->watchdog_tid;
4779 Adapter->watchdog_tid = 0;
4781 mutex_exit(&Adapter->watchdog_lock);
4788 stop_link_timer(struct e1000g *Adapter)
4793 mutex_enter(&Adapter->link_lock);
4795 tid = Adapter->link_tid;
4796 Adapter->link_tid = 0;
4798 mutex_exit(&Adapter->link_lock);
4823 e1000g_clear_interrupt(struct e1000g *Adapter)
4825 E1000_WRITE_REG(&Adapter->shared, E1000_IMC,
4830 e1000g_mask_interrupt(struct e1000g *Adapter)
4832 E1000_WRITE_REG(&Adapter->shared, E1000_IMS,
4835 if (Adapter->tx_intr_enable)
4836 e1000g_mask_tx_interrupt(Adapter);
4843 e1000g_clear_all_interrupts(struct e1000g *Adapter)
4845 E1000_WRITE_REG(&Adapter->shared, E1000_IMC, 0xffffffff);
4849 e1000g_mask_tx_interrupt(struct e1000g *Adapter)
4851 E1000_WRITE_REG(&Adapter->shared, E1000_IMS, E1000_IMS_TXDW);
4855 e1000g_clear_tx_interrupt(struct e1000g *Adapter)
4857 E1000_WRITE_REG(&Adapter->shared, E1000_IMC, E1000_IMS_TXDW);
4861 e1000g_smartspeed(struct e1000g *Adapter)
4863 struct e1000_hw *hw = &Adapter->shared;
4880 if (Adapter->smartspeed == 0) {
4913 Adapter->smartspeed++;
4931 } else if (Adapter->smartspeed == E1000_SMARTSPEED_DOWNSHIFT) {
4965 if (Adapter->smartspeed++ == E1000_SMARTSPEED_MAX)
4966 Adapter->smartspeed = 0;
4995 e1000g_stall_check(struct e1000g *Adapter)
4999 tx_ring = Adapter->tx_ring;
5001 if (Adapter->link_state != LINK_STATE_UP)
5006 if (Adapter->stall_flag)
5210 e1000g_loopback_ioctl(struct e1000g *Adapter, struct iocblk *iocp, mblk_t *mp)
5219 hw = &Adapter->shared;
5226 "Loopback is not supported on e1000g%d", Adapter->instance);
5239 rw_enter(&Adapter->chip_lock, RW_WRITER);
5240 e1000g_get_phy_state(Adapter);
5249 e1000g_get_phy_state(Adapter);
5250 rw_exit(&Adapter->chip_lock);
5253 if ((Adapter->phy_ext_status & IEEE_ESR_1000T_FD_CAPS) ||
5254 (Adapter->phy_ext_status & IEEE_ESR_1000X_FD_CAPS) ||
5266 if ((Adapter->phy_status & MII_SR_100X_FD_CAPS) ||
5267 (Adapter->phy_status & MII_SR_100T2_FD_CAPS))
5269 if (Adapter->phy_status & MII_SR_10T_FD_CAPS)
5278 if ((Adapter->phy_ext_status & IEEE_ESR_1000T_FD_CAPS) ||
5279 (Adapter->phy_ext_status & IEEE_ESR_1000X_FD_CAPS) ||
5291 if ((Adapter->phy_status & MII_SR_100X_FD_CAPS) ||
5292 (Adapter->phy_status & MII_SR_100T2_FD_CAPS))
5294 if (Adapter->phy_status & MII_SR_10T_FD_CAPS)
5304 if ((Adapter->phy_ext_status & IEEE_ESR_1000T_FD_CAPS) ||
5305 (Adapter->phy_ext_status & IEEE_ESR_1000X_FD_CAPS) ||
5317 if ((Adapter->phy_status & MII_SR_100X_FD_CAPS) ||
5318 (Adapter->phy_status & MII_SR_100T2_FD_CAPS))
5320 if (Adapter->phy_status & MII_SR_10T_FD_CAPS)
5330 *lbmp = Adapter->loopback_mode;
5339 if (!e1000g_set_loopback_mode(Adapter, *lbmp))
5347 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
5348 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
5381 e1000g_set_loopback_mode(struct e1000g *Adapter, uint32_t mode)
5387 if (mode == Adapter->loopback_mode)
5390 hw = &Adapter->shared;
5393 Adapter->loopback_mode = mode;
5398 (void) e1000g_reset_adapter(Adapter);
5405 rw_enter(&Adapter->chip_lock, RW_WRITER);
5409 rw_exit(&Adapter->chip_lock);
5413 e1000g_set_external_loopback_1000(Adapter);
5417 e1000g_set_external_loopback_100(Adapter);
5421 e1000g_set_external_loopback_10(Adapter);
5425 e1000g_set_internal_loopback(Adapter);
5431 rw_exit(&Adapter->chip_lock);
5437 rw_enter(&Adapter->chip_lock, RW_WRITER);
5439 link_up = e1000g_link_up(Adapter);
5441 rw_exit(&Adapter->chip_lock);
5444 E1000G_DEBUGLOG_0(Adapter, E1000G_INFO_LEVEL,
5448 E1000G_DEBUGLOG_0(Adapter, E1000G_INFO_LEVEL,
5450 (void) e1000g_reset_adapter(Adapter);
5458 Adapter->loopback_mode = E1000G_LB_NONE;
5462 (void) e1000g_reset_adapter(Adapter);
5465 E1000G_DEBUGLOG_0(Adapter, E1000G_INFO_LEVEL,
5481 e1000g_set_internal_loopback(struct e1000g *Adapter)
5490 hw = &Adapter->shared;
5652 e1000g_set_external_loopback_1000(struct e1000g *Adapter)
5662 hw = &Adapter->shared;
5751 Adapter->param_adv_autoneg = 1;
5752 Adapter->param_adv_1000fdx = 1;
5753 (void) e1000g_reset_link(Adapter);
5759 e1000g_set_external_loopback_100(struct e1000g *Adapter)
5765 hw = &Adapter->shared;
5796 e1000g_set_external_loopback_10(struct e1000g *Adapter)
5802 hw = &Adapter->shared;
5834 e1000g_find_mac_address(struct e1000g *Adapter)
5836 struct e1000_hw *hw = &Adapter->shared;
5852 err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, Adapter->dip,
5867 if (ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, Adapter->dip, 0,
5884 err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, Adapter->dip,
5905 e1000g_add_intrs(struct e1000g *Adapter)
5911 devinfo = Adapter->dip;
5917 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
5929 if (Adapter->shared.mac.type < e1000_82571)
5930 Adapter->msi_enable = B_FALSE;
5932 if ((intr_types & DDI_INTR_TYPE_MSI) && Adapter->msi_enable) {
5933 rc = e1000g_intr_add(Adapter, DDI_INTR_TYPE_MSI);
5937 E1000G_DEBUGLOG_0(Adapter, E1000G_WARN_LEVEL,
5940 Adapter->intr_type = DDI_INTR_TYPE_MSI;
5944 if ((Adapter->intr_type == 0) &&
5946 rc = e1000g_intr_add(Adapter, DDI_INTR_TYPE_FIXED);
5949 E1000G_DEBUGLOG_0(Adapter, E1000G_WARN_LEVEL,
5954 Adapter->intr_type = DDI_INTR_TYPE_FIXED;
5957 if (Adapter->intr_type == 0) {
5958 E1000G_DEBUGLOG_0(Adapter, E1000G_WARN_LEVEL,
5970 e1000g_intr_add(struct e1000g *Adapter, int intr_type)
5978 devinfo = Adapter->dip;
5983 E1000G_DEBUGLOG_2(Adapter, E1000G_WARN_LEVEL,
5992 E1000G_DEBUGLOG_2(Adapter, E1000G_WARN_LEVEL,
6000 E1000G_DEBUGLOG_2(Adapter, E1000G_WARN_LEVEL,
6006 Adapter->intr_size = count * sizeof (ddi_intr_handle_t);
6007 Adapter->htable = kmem_alloc(Adapter->intr_size, KM_SLEEP);
6013 rc = ddi_intr_alloc(devinfo, Adapter->htable, intr_type, inum,
6017 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6020 kmem_free(Adapter->htable, Adapter->intr_size);
6026 E1000G_DEBUGLOG_2(Adapter, E1000G_WARN_LEVEL,
6031 Adapter->intr_cnt = actual;
6034 rc = ddi_intr_get_pri(Adapter->htable[0], &Adapter->intr_pri);
6037 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6042 (void) ddi_intr_free(Adapter->htable[y]);
6044 kmem_free(Adapter->htable, Adapter->intr_size);
6054 if (Adapter->shared.mac.type < e1000_82571)
6061 rc = ddi_intr_add_handler(Adapter->htable[x],
6062 intr_handler, (caddr_t)Adapter, NULL);
6065 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6071 Adapter->htable[y]);
6075 (void) ddi_intr_free(Adapter->htable[y]);
6077 kmem_free(Adapter->htable, Adapter->intr_size);
6082 rc = ddi_intr_get_cap(Adapter->htable[0], &Adapter->intr_cap);
6085 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6090 (void) ddi_intr_remove_handler(Adapter->htable[y]);
6091 (void) ddi_intr_free(Adapter->htable[y]);
6094 kmem_free(Adapter->htable, Adapter->intr_size);
6102 e1000g_rem_intrs(struct e1000g *Adapter)
6107 for (x = 0; x < Adapter->intr_cnt; x++) {
6108 rc = ddi_intr_remove_handler(Adapter->htable[x]);
6110 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6115 rc = ddi_intr_free(Adapter->htable[x]);
6117 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6123 kmem_free(Adapter->htable, Adapter->intr_size);
6129 e1000g_enable_intrs(struct e1000g *Adapter)
6135 if (Adapter->intr_cap & DDI_INTR_FLAG_BLOCK) {
6137 rc = ddi_intr_block_enable(Adapter->htable,
6138 Adapter->intr_cnt);
6140 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6146 for (x = 0; x < Adapter->intr_cnt; x++) {
6147 rc = ddi_intr_enable(Adapter->htable[x]);
6149 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6160 e1000g_disable_intrs(struct e1000g *Adapter)
6166 if (Adapter->intr_cap & DDI_INTR_FLAG_BLOCK) {
6167 rc = ddi_intr_block_disable(Adapter->htable,
6168 Adapter->intr_cnt);
6170 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6175 for (x = 0; x < Adapter->intr_cnt; x++) {
6176 rc = ddi_intr_disable(Adapter->htable[x]);
6178 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6192 e1000g_get_phy_state(struct e1000g *Adapter)
6194 struct e1000_hw *hw = &Adapter->shared;
6197 (void) e1000_read_phy_reg(hw, PHY_CONTROL, &Adapter->phy_ctrl);
6198 (void) e1000_read_phy_reg(hw, PHY_STATUS, &Adapter->phy_status);
6200 &Adapter->phy_an_adv);
6202 &Adapter->phy_an_exp);
6204 &Adapter->phy_ext_status);
6206 &Adapter->phy_1000t_ctrl);
6208 &Adapter->phy_1000t_status);
6210 &Adapter->phy_lp_able);
6212 Adapter->param_autoneg_cap =
6213 (Adapter->phy_status & MII_SR_AUTONEG_CAPS) ? 1 : 0;
6214 Adapter->param_pause_cap =
6215 (Adapter->phy_an_adv & NWAY_AR_PAUSE) ? 1 : 0;
6216 Adapter->param_asym_pause_cap =
6217 (Adapter->phy_an_adv & NWAY_AR_ASM_DIR) ? 1 : 0;
6218 Adapter->param_1000fdx_cap =
6219 ((Adapter->phy_ext_status & IEEE_ESR_1000T_FD_CAPS) ||
6220 (Adapter->phy_ext_status & IEEE_ESR_1000X_FD_CAPS)) ? 1 : 0;
6221 Adapter->param_1000hdx_cap =
6222 ((Adapter->phy_ext_status & IEEE_ESR_1000T_HD_CAPS) ||
6223 (Adapter->phy_ext_status & IEEE_ESR_1000X_HD_CAPS)) ? 1 : 0;
6224 Adapter->param_100t4_cap =
6225 (Adapter->phy_status & MII_SR_100T4_CAPS) ? 1 : 0;
6226 Adapter->param_100fdx_cap =
6227 ((Adapter->phy_status & MII_SR_100X_FD_CAPS) ||
6228 (Adapter->phy_status & MII_SR_100T2_FD_CAPS)) ? 1 : 0;
6229 Adapter->param_100hdx_cap =
6230 ((Adapter->phy_status & MII_SR_100X_HD_CAPS) ||
6231 (Adapter->phy_status & MII_SR_100T2_HD_CAPS)) ? 1 : 0;
6232 Adapter->param_10fdx_cap =
6233 (Adapter->phy_status & MII_SR_10T_FD_CAPS) ? 1 : 0;
6234 Adapter->param_10hdx_cap =
6235 (Adapter->phy_status & MII_SR_10T_HD_CAPS) ? 1 : 0;
6237 Adapter->param_adv_autoneg = hw->mac.autoneg;
6238 Adapter->param_adv_pause =
6239 (Adapter->phy_an_adv & NWAY_AR_PAUSE) ? 1 : 0;
6240 Adapter->param_adv_asym_pause =
6241 (Adapter->phy_an_adv & NWAY_AR_ASM_DIR) ? 1 : 0;
6242 Adapter->param_adv_1000hdx =
6243 (Adapter->phy_1000t_ctrl & CR_1000T_HD_CAPS) ? 1 : 0;
6244 Adapter->param_adv_100t4 =
6245 (Adapter->phy_an_adv & NWAY_AR_100T4_CAPS) ? 1 : 0;
6246 if (Adapter->param_adv_autoneg == 1) {
6247 Adapter->param_adv_1000fdx =
6248 (Adapter->phy_1000t_ctrl & CR_1000T_FD_CAPS)
6250 Adapter->param_adv_100fdx =
6251 (Adapter->phy_an_adv & NWAY_AR_100TX_FD_CAPS)
6253 Adapter->param_adv_100hdx =
6254 (Adapter->phy_an_adv & NWAY_AR_100TX_HD_CAPS)
6256 Adapter->param_adv_10fdx =
6257 (Adapter->phy_an_adv & NWAY_AR_10T_FD_CAPS) ? 1 : 0;
6258 Adapter->param_adv_10hdx =
6259 (Adapter->phy_an_adv & NWAY_AR_10T_HD_CAPS) ? 1 : 0;
6262 Adapter->param_lp_autoneg =
6263 (Adapter->phy_an_exp & NWAY_ER_LP_NWAY_CAPS) ? 1 : 0;
6264 Adapter->param_lp_pause =
6265 (Adapter->phy_lp_able & NWAY_LPAR_PAUSE) ? 1 : 0;
6266 Adapter->param_lp_asym_pause =
6267 (Adapter->phy_lp_able & NWAY_LPAR_ASM_DIR) ? 1 : 0;
6268 Adapter->param_lp_1000fdx =
6269 (Adapter->phy_1000t_status & SR_1000T_LP_FD_CAPS) ? 1 : 0;
6270 Adapter->param_lp_1000hdx =
6271 (Adapter->phy_1000t_status & SR_1000T_LP_HD_CAPS) ? 1 : 0;
6272 Adapter->param_lp_100t4 =
6273 (Adapter->phy_lp_able & NWAY_LPAR_100T4_CAPS) ? 1 : 0;
6274 Adapter->param_lp_100fdx =
6275 (Adapter->phy_lp_able & NWAY_LPAR_100TX_FD_CAPS) ? 1 : 0;
6276 Adapter->param_lp_100hdx =
6277 (Adapter->phy_lp_able & NWAY_LPAR_100TX_HD_CAPS) ? 1 : 0;
6278 Adapter->param_lp_10fdx =
6279 (Adapter->phy_lp_able & NWAY_LPAR_10T_FD_CAPS) ? 1 : 0;
6280 Adapter->param_lp_10hdx =
6281 (Adapter->phy_lp_able & NWAY_LPAR_10T_HD_CAPS) ? 1 : 0;
6287 Adapter->param_autoneg_cap = 0;
6288 Adapter->param_pause_cap = 1;
6289 Adapter->param_asym_pause_cap = 1;
6290 Adapter->param_1000fdx_cap = 1;
6291 Adapter->param_1000hdx_cap = 0;
6292 Adapter->param_100t4_cap = 0;
6293 Adapter->param_100fdx_cap = 0;
6294 Adapter->param_100hdx_cap = 0;
6295 Adapter->param_10fdx_cap = 0;
6296 Adapter->param_10hdx_cap = 0;
6298 Adapter->param_adv_autoneg = 0;
6299 Adapter->param_adv_pause = 1;
6300 Adapter->param_adv_asym_pause = 1;
6301 Adapter->param_adv_1000fdx = 1;
6302 Adapter->param_adv_1000hdx = 0;
6303 Adapter->param_adv_100t4 = 0;
6304 Adapter->param_adv_100fdx = 0;
6305 Adapter->param_adv_100hdx = 0;
6306 Adapter->param_adv_10fdx = 0;
6307 Adapter->param_adv_10hdx = 0;
6309 Adapter->param_lp_autoneg = 0;
6310 Adapter->param_lp_pause = 0;
6311 Adapter->param_lp_asym_pause = 0;
6312 Adapter->param_lp_1000fdx = 0;
6313 Adapter->param_lp_1000hdx = 0;
6314 Adapter->param_lp_100t4 = 0;
6315 Adapter->param_lp_100fdx = 0;
6316 Adapter->param_lp_100hdx = 0;
6317 Adapter->param_lp_10fdx = 0;
6318 Adapter->param_lp_10hdx = 0;
6361 e1000g_fm_init(struct e1000g *Adapter)
6367 if (Adapter->fm_capabilities & DDI_FM_ACCCHK_CAPABLE) {
6373 if (Adapter->fm_capabilities & DDI_FM_DMACHK_CAPABLE) {
6381 if (Adapter->fm_capabilities) {
6384 ddi_fm_init(Adapter->dip, &Adapter->fm_capabilities, &iblk);
6389 if (DDI_FM_EREPORT_CAP(Adapter->fm_capabilities) ||
6390 DDI_FM_ERRCB_CAP(Adapter->fm_capabilities))
6391 pci_ereport_setup(Adapter->dip);
6396 if (DDI_FM_ERRCB_CAP(Adapter->fm_capabilities))
6397 ddi_fm_handler_register(Adapter->dip,
6398 e1000g_fm_error_cb, (void*) Adapter);
6403 e1000g_fm_fini(struct e1000g *Adapter)
6406 if (Adapter->fm_capabilities) {
6411 if (DDI_FM_EREPORT_CAP(Adapter->fm_capabilities) ||
6412 DDI_FM_ERRCB_CAP(Adapter->fm_capabilities))
6413 pci_ereport_teardown(Adapter->dip);
6418 if (DDI_FM_ERRCB_CAP(Adapter->fm_capabilities))
6419 ddi_fm_handler_unregister(Adapter->dip);
6423 ddi_fm_fini(Adapter->dip);
6424 if (Adapter->priv_dip != NULL) {
6425 DEVI(Adapter->priv_dip)->devi_fmhdl = NULL;
6432 e1000g_fm_ereport(struct e1000g *Adapter, char *detail)
6439 if (DDI_FM_EREPORT_CAP(Adapter->fm_capabilities)) {
6440 ddi_fm_ereport_post(Adapter->dip, buf, ena, DDI_NOSLEEP,
6458 struct e1000g *Adapter;
6460 Adapter = (struct e1000g *)ddi_get_driver_private(devinfo);
6462 if (Adapter == NULL)
6465 e1000g_clear_all_interrupts(Adapter);
6467 (void) e1000_reset_hw(&Adapter->shared);
6470 E1000_WRITE_REG(&Adapter->shared, E1000_TDH(0), 0);
6471 E1000_WRITE_REG(&Adapter->shared, E1000_TDT(0), 0);
6474 E1000_WRITE_REG(&Adapter->shared, E1000_RDH(0), 0);
6475 E1000_WRITE_REG(&Adapter->shared, E1000_RDT(0), 0);
6489 e1000g_param_sync(struct e1000g *Adapter)
6491 Adapter->param_en_1000fdx = Adapter->param_adv_1000fdx;
6492 Adapter->param_en_1000hdx = Adapter->param_adv_1000hdx;
6493 Adapter->param_en_100fdx = Adapter->param_adv_100fdx;
6494 Adapter->param_en_100hdx = Adapter->param_adv_100hdx;
6495 Adapter->param_en_10fdx = Adapter->param_adv_10fdx;
6496 Adapter->param_en_10hdx = Adapter->param_adv_10hdx;
6573 e1000g_restore_promisc(struct e1000g *Adapter)
6575 if (Adapter->e1000g_promisc) {
6578 rctl = E1000_READ_REG(&Adapter->shared, E1000_RCTL);
6580 E1000_WRITE_REG(&Adapter->shared, E1000_RCTL, rctl);