Lines Matching defs:Adapter

155 static void e1000g_fm_init(struct e1000g *Adapter);
156 static void e1000g_fm_fini(struct e1000g *Adapter);
160 static void e1000g_restore_promisc(struct e1000g *Adapter);
399 struct e1000g *Adapter;
425 Adapter =
426 (struct e1000g *)kmem_zalloc(sizeof (*Adapter), KM_SLEEP);
428 Adapter->dip = devinfo;
429 Adapter->instance = instance;
430 Adapter->tx_ring->adapter = Adapter;
431 Adapter->rx_ring->adapter = Adapter;
433 hw = &Adapter->shared;
434 osdep = &Adapter->osdep;
436 osdep->adapter = Adapter;
438 ddi_set_driver_private(devinfo, (caddr_t)Adapter);
443 (void) e1000g_get_prop(Adapter, "fm-capable",
447 &Adapter->fm_capabilities);
448 e1000g_fm_init(Adapter);
449 Adapter->attach_progress |= ATTACH_PROGRESS_FMINIT;
455 e1000g_log(Adapter, CE_WARN, "PCI configuration failed");
458 Adapter->attach_progress |= ATTACH_PROGRESS_PCI_CONFIG;
463 if (e1000g_identify_hardware(Adapter) != DDI_SUCCESS) {
464 e1000g_log(Adapter, CE_WARN, "Identify hardware failed");
471 if (e1000g_regs_map(Adapter) != DDI_SUCCESS) {
472 e1000g_log(Adapter, CE_WARN, "Mapping registers failed");
475 Adapter->attach_progress |= ATTACH_PROGRESS_REGS_MAP;
480 if (e1000g_set_driver_params(Adapter) != DDI_SUCCESS) {
483 Adapter->attach_progress |= ATTACH_PROGRESS_SETUP;
485 if (e1000g_check_acc_handle(Adapter->osdep.cfg_handle) != DDI_FM_OK) {
486 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
493 if (e1000g_add_intrs(Adapter) != DDI_SUCCESS) {
494 e1000g_log(Adapter, CE_WARN, "Add interrupts failed");
497 Adapter->attach_progress |= ATTACH_PROGRESS_ADD_INTR;
505 e1000g_init_locks(Adapter);
506 Adapter->attach_progress |= ATTACH_PROGRESS_LOCKS;
511 if (e1000g_init_stats(Adapter) != DDI_SUCCESS) {
512 e1000g_log(Adapter, CE_WARN, "Init stats failed");
515 Adapter->attach_progress |= ATTACH_PROGRESS_KSTATS;
520 rw_enter(&Adapter->chip_lock, RW_WRITER);
521 if (e1000g_init(Adapter) != DDI_SUCCESS) {
522 rw_exit(&Adapter->chip_lock);
523 e1000g_log(Adapter, CE_WARN, "Adapter initialization failed");
526 rw_exit(&Adapter->chip_lock);
527 Adapter->attach_progress |= ATTACH_PROGRESS_INIT;
532 if (e1000g_register_mac(Adapter) != DDI_SUCCESS) {
533 e1000g_log(Adapter, CE_WARN, "Register MAC failed");
536 Adapter->attach_progress |= ATTACH_PROGRESS_MAC;
542 if (e1000g_enable_intrs(Adapter) != DDI_SUCCESS) {
543 e1000g_log(Adapter, CE_WARN, "Enable DDI interrupts failed");
546 Adapter->attach_progress |= ATTACH_PROGRESS_ENABLE_INTR;
556 Adapter->priv_dip =
558 bcopy(DEVI(devinfo), DEVI(Adapter->priv_dip),
565 devi_node->priv_dip = Adapter->priv_dip;
569 Adapter->priv_devi_node = devi_node;
584 Adapter->e1000g_state = E1000G_INITIALIZED;
588 e1000g_unattach(devinfo, Adapter);
593 e1000g_register_mac(struct e1000g *Adapter)
595 struct e1000_hw *hw = &Adapter->shared;
603 mac->m_driver = Adapter;
604 mac->m_dip = Adapter->dip;
608 mac->m_max_sdu = Adapter->default_mtu;
613 err = mac_register(mac, &Adapter->mh);
620 e1000g_identify_hardware(struct e1000g *Adapter)
622 struct e1000_hw *hw = &Adapter->shared;
623 struct e1000g_osdep *osdep = &Adapter->osdep;
638 E1000G_DEBUGLOG_0(Adapter, E1000G_INFO_LEVEL,
647 e1000g_regs_map(struct e1000g *Adapter)
649 dev_info_t *devinfo = Adapter->dip;
650 struct e1000_hw *hw = &Adapter->shared;
651 struct e1000g_osdep *osdep = &Adapter->osdep;
660 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
669 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
685 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
695 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
726 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
734 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
744 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
765 e1000g_set_driver_params(struct e1000g *Adapter)
769 hw = &Adapter->shared;
773 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
780 E1000G_DEBUGLOG_0(Adapter, CE_WARN,
806 Adapter->strip_crc = B_TRUE;
808 Adapter->strip_crc = B_FALSE;
812 e1000g_setup_max_mtu(Adapter);
817 e1000g_force_speed_duplex(Adapter);
820 e1000g_get_max_frame_size(Adapter);
823 e1000g_get_conf(Adapter);
826 e1000g_pch_limits(Adapter);
829 e1000g_set_bufsize(Adapter);
832 Adapter->master_latency_timer = DEFAULT_MASTER_LATENCY_TIMER;
842 Adapter->link_state = LINK_STATE_UNKNOWN;
845 Adapter->rx_intr_delay = DEFAULT_RX_INTR_DELAY;
846 Adapter->rx_intr_abs_delay = DEFAULT_RX_INTR_ABS_DELAY;
849 Adapter->tx_intr_enable = DEFAULT_TX_INTR_ENABLE;
850 Adapter->tx_bcopy_thresh = DEFAULT_TX_BCOPY_THRESHOLD;
851 Adapter->tx_intr_delay = DEFAULT_TX_INTR_DELAY;
852 Adapter->tx_intr_abs_delay = DEFAULT_TX_INTR_ABS_DELAY;
855 Adapter->rx_bcopy_thresh = DEFAULT_RX_BCOPY_THRESHOLD;
861 e1000g_setup_max_mtu(struct e1000g *Adapter)
863 struct e1000_mac_info *mac = &Adapter->shared.mac;
864 struct e1000_phy_info *phy = &Adapter->shared.phy;
871 Adapter->max_mtu = ETHERMTU;
876 Adapter->max_mtu = ETHERMTU;
878 Adapter->max_mtu = MAXIMUM_MTU_9K;
882 Adapter->max_mtu = MAXIMUM_MTU_4K;
892 Adapter->max_mtu = e1000g_jumbo_mtu;
894 Adapter->max_mtu = MAXIMUM_MTU_9K;
899 Adapter->max_mtu = FRAME_SIZE_UPTO_16K -
906 e1000g_set_bufsize(struct e1000g *Adapter)
908 struct e1000_mac_info *mac = &Adapter->shared.mac;
912 dev_info_t *devinfo = Adapter->dip;
917 Adapter->sys_page_sz = ddi_ptob(devinfo, (ulong_t)1);
922 if (Adapter->sys_page_sz == iommu_pagesize) {
924 Adapter->sys_page_sz = 0x4000;
926 if (Adapter->sys_page_sz > iommu_pagesize)
927 Adapter->sys_page_sz = iommu_pagesize;
930 if (Adapter->lso_enable) {
931 Adapter->dvma_page_num = E1000_LSO_MAXLEN /
932 Adapter->sys_page_sz + E1000G_DEFAULT_DVMA_PAGE_NUM;
934 Adapter->dvma_page_num = Adapter->max_frame_size /
935 Adapter->sys_page_sz + E1000G_DEFAULT_DVMA_PAGE_NUM;
937 ASSERT(Adapter->dvma_page_num >= E1000G_DEFAULT_DVMA_PAGE_NUM);
940 Adapter->min_frame_size = ETHERMIN + ETHERFCSL;
942 if (Adapter->mem_workaround_82546 &&
946 Adapter->rx_buffer_size = E1000_RX_BUFFER_SIZE_2K;
948 rx_size = Adapter->max_frame_size;
951 Adapter->rx_buffer_size = E1000_RX_BUFFER_SIZE_4K;
954 Adapter->rx_buffer_size = E1000_RX_BUFFER_SIZE_8K;
957 Adapter->rx_buffer_size = E1000_RX_BUFFER_SIZE_16K;
959 Adapter->rx_buffer_size = E1000_RX_BUFFER_SIZE_2K;
961 Adapter->rx_buffer_size += E1000G_IPALIGNROOM;
963 tx_size = Adapter->max_frame_size;
965 Adapter->tx_buffer_size = E1000_TX_BUFFER_SIZE_4K;
968 Adapter->tx_buffer_size = E1000_TX_BUFFER_SIZE_8K;
971 Adapter->tx_buffer_size = E1000_TX_BUFFER_SIZE_16K;
973 Adapter->tx_buffer_size = E1000_TX_BUFFER_SIZE_2K;
987 Adapter->rx_buf_align = RECEIVE_BUFFER_ALIGN_SIZE;
989 Adapter->rx_buf_align = 1;
1010 struct e1000g *Adapter;
1024 Adapter = (struct e1000g *)ddi_get_driver_private(devinfo);
1025 if (Adapter == NULL)
1028 rx_drain = e1000g_rx_drain(Adapter);
1032 if (mac_unregister(Adapter->mh) != 0) {
1033 e1000g_log(Adapter, CE_WARN, "Unregister MAC failed");
1036 Adapter->attach_progress &= ~ATTACH_PROGRESS_MAC;
1038 ASSERT(!(Adapter->e1000g_state & E1000G_STARTED));
1043 e1000g_unattach(devinfo, Adapter);
1071 e1000g_unattach(dev_info_t *devinfo, struct e1000g *Adapter)
1076 if (Adapter->attach_progress & ATTACH_PROGRESS_ENABLE_INTR) {
1077 (void) e1000g_disable_intrs(Adapter);
1080 if (Adapter->attach_progress & ATTACH_PROGRESS_MAC) {
1081 (void) mac_unregister(Adapter->mh);
1084 if (Adapter->attach_progress & ATTACH_PROGRESS_ADD_INTR) {
1085 (void) e1000g_rem_intrs(Adapter);
1088 if (Adapter->attach_progress & ATTACH_PROGRESS_SETUP) {
1092 if (Adapter->attach_progress & ATTACH_PROGRESS_KSTATS) {
1093 kstat_delete((kstat_t *)Adapter->e1000g_ksp);
1096 if (Adapter->attach_progress & ATTACH_PROGRESS_INIT) {
1097 stop_link_timer(Adapter);
1100 result = e1000_reset_hw(&Adapter->shared);
1104 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1105 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
1109 e1000g_release_multicast(Adapter);
1111 if (Adapter->attach_progress & ATTACH_PROGRESS_REGS_MAP) {
1112 if (Adapter->osdep.reg_handle != NULL)
1113 ddi_regs_map_free(&Adapter->osdep.reg_handle);
1114 if (Adapter->osdep.ich_flash_handle != NULL)
1115 ddi_regs_map_free(&Adapter->osdep.ich_flash_handle);
1116 if (Adapter->osdep.io_reg_handle != NULL)
1117 ddi_regs_map_free(&Adapter->osdep.io_reg_handle);
1120 if (Adapter->attach_progress & ATTACH_PROGRESS_PCI_CONFIG) {
1121 if (Adapter->osdep.cfg_handle != NULL)
1122 pci_config_teardown(&Adapter->osdep.cfg_handle);
1125 if (Adapter->attach_progress & ATTACH_PROGRESS_LOCKS) {
1126 e1000g_destroy_locks(Adapter);
1129 if (Adapter->attach_progress & ATTACH_PROGRESS_FMINIT) {
1130 e1000g_fm_fini(Adapter);
1134 if (e1000g_force_detach && (Adapter->priv_devi_node != NULL)) {
1135 devi_node = Adapter->priv_devi_node;
1144 kmem_free((caddr_t)Adapter, sizeof (struct e1000g));
1212 e1000g_init_locks(struct e1000g *Adapter)
1217 rw_init(&Adapter->chip_lock, NULL,
1218 RW_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1219 mutex_init(&Adapter->link_lock, NULL,
1220 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1221 mutex_init(&Adapter->watchdog_lock, NULL,
1222 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1224 tx_ring = Adapter->tx_ring;
1227 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1229 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1231 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1233 rx_ring = Adapter->rx_ring;
1236 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1240 e1000g_destroy_locks(struct e1000g *Adapter)
1245 tx_ring = Adapter->tx_ring;
1250 rx_ring = Adapter->rx_ring;
1253 mutex_destroy(&Adapter->link_lock);
1254 mutex_destroy(&Adapter->watchdog_lock);
1255 rw_destroy(&Adapter->chip_lock);
1258 e1000_destroy_hw_mutex(&Adapter->shared);
1264 struct e1000g *Adapter;
1266 Adapter = (struct e1000g *)ddi_get_driver_private(devinfo);
1267 if (Adapter == NULL)
1268 e1000g_log(Adapter, CE_PANIC,
1271 if (Adapter->dip != devinfo)
1272 e1000g_log(Adapter, CE_PANIC,
1275 rw_enter(&Adapter->chip_lock, RW_WRITER);
1277 if (Adapter->e1000g_state & E1000G_STARTED) {
1278 if (e1000g_start(Adapter, B_FALSE) != DDI_SUCCESS) {
1279 rw_exit(&Adapter->chip_lock);
1284 e1000g_log(Adapter, CE_WARN,
1289 enable_watchdog_timer(Adapter);
1292 Adapter->e1000g_state &= ~E1000G_SUSPENDED;
1294 rw_exit(&Adapter->chip_lock);
1302 struct e1000g *Adapter;
1304 Adapter = (struct e1000g *)ddi_get_driver_private(devinfo);
1305 if (Adapter == NULL)
1308 rw_enter(&Adapter->chip_lock, RW_WRITER);
1310 Adapter->e1000g_state |= E1000G_SUSPENDED;
1313 if (!(Adapter->e1000g_state & E1000G_STARTED)) {
1314 rw_exit(&Adapter->chip_lock);
1318 e1000g_stop(Adapter, B_FALSE);
1320 rw_exit(&Adapter->chip_lock);
1323 disable_watchdog_timer(Adapter);
1324 stop_link_timer(Adapter);
1325 stop_82547_timer(Adapter->tx_ring);
1331 e1000g_init(struct e1000g *Adapter)
1339 hw = &Adapter->shared;
1350 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1367 e1000g_log(Adapter, CE_WARN,
1370 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1380 result = e1000g_find_mac_address(Adapter);
1390 e1000g_log(Adapter, CE_WARN, "Read mac addr failed");
1391 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1397 e1000g_log(Adapter, CE_WARN, "Invalid mac addr");
1398 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1406 if (Adapter->master_latency_timer) {
1407 pci_config_put8(Adapter->osdep.cfg_handle,
1408 PCI_CONF_LATENCY_TIMER, Adapter->master_latency_timer);
1415 if (Adapter->max_frame_size > FRAME_SIZE_UPTO_8K)
1425 if (Adapter->max_frame_size > FRAME_SIZE_UPTO_8K)
1446 if (Adapter->max_frame_size > FRAME_SIZE_UPTO_8K)
1471 ((pba << 10) - Adapter->max_frame_size)));
1490 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1514 e1000g_log(Adapter, CE_WARN, "Initialize hw failed");
1515 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1534 e1000g_init_unicst(Adapter);
1541 (uint8_t *)Adapter->mcast_table, Adapter->mcast_count);
1551 E1000_WRITE_REG(hw, E1000_ITR, Adapter->intr_throttling_rate);
1553 Adapter->intr_adaptive = B_FALSE;
1561 mutex_enter(&Adapter->link_lock);
1563 Adapter->link_complete = B_TRUE;
1565 Adapter->link_complete = B_FALSE;
1566 Adapter->link_tid = timeout(e1000g_link_timer,
1567 (void *)Adapter, link_timeout);
1569 mutex_exit(&Adapter->link_lock);
1572 e1000g_get_phy_state(Adapter);
1574 e1000g_param_sync(Adapter);
1576 Adapter->init_count++;
1578 if (e1000g_check_acc_handle(Adapter->osdep.cfg_handle) != DDI_FM_OK) {
1581 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
1585 Adapter->poll_mode = e1000g_poll_mode;
1590 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
1595 e1000g_alloc_rx_data(struct e1000g *Adapter)
1600 rx_ring = Adapter->rx_ring;
1607 rx_data->priv_devi_node = Adapter->priv_devi_node;
1611 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1613 MUTEX_DRIVER, DDI_INTR_PRI(Adapter->intr_pri));
1653 e1000g_link_up(struct e1000g *Adapter)
1655 struct e1000_hw *hw = &Adapter->shared;
1833 struct e1000g *Adapter = (struct e1000g *)arg;
1835 rw_enter(&Adapter->chip_lock, RW_WRITER);
1837 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
1838 rw_exit(&Adapter->chip_lock);
1842 if (e1000g_start(Adapter, B_TRUE) != DDI_SUCCESS) {
1843 rw_exit(&Adapter->chip_lock);
1847 Adapter->e1000g_state |= E1000G_STARTED;
1849 rw_exit(&Adapter->chip_lock);
1852 enable_watchdog_timer(Adapter);
1858 e1000g_start(struct e1000g *Adapter, boolean_t global)
1863 if (e1000g_alloc_rx_data(Adapter) != DDI_SUCCESS) {
1864 e1000g_log(Adapter, CE_WARN, "Allocate rx data failed");
1869 if (e1000g_alloc_dma_resources(Adapter) != DDI_SUCCESS) {
1870 e1000g_log(Adapter, CE_WARN,
1874 Adapter->rx_buffer_setup = B_FALSE;
1877 if (!(Adapter->attach_progress & ATTACH_PROGRESS_INIT)) {
1878 if (e1000g_init(Adapter) != DDI_SUCCESS) {
1879 e1000g_log(Adapter, CE_WARN,
1880 "Adapter initialization failed");
1886 e1000g_tx_setup(Adapter);
1890 e1000g_rx_setup(Adapter);
1894 e1000g_restore_promisc(Adapter);
1896 e1000g_mask_interrupt(Adapter);
1898 Adapter->attach_progress |= ATTACH_PROGRESS_INIT;
1900 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
1901 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
1908 rx_data = Adapter->rx_ring->rx_data;
1911 e1000g_release_dma_resources(Adapter);
1917 (void) e1000_reset_hw(&Adapter->shared);
1926 struct e1000g *Adapter = (struct e1000g *)arg;
1929 (void) e1000g_tx_drain(Adapter);
1931 rw_enter(&Adapter->chip_lock, RW_WRITER);
1933 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
1934 rw_exit(&Adapter->chip_lock);
1937 Adapter->e1000g_state &= ~E1000G_STARTED;
1938 e1000g_stop(Adapter, B_TRUE);
1940 rw_exit(&Adapter->chip_lock);
1943 disable_watchdog_timer(Adapter);
1944 stop_link_timer(Adapter);
1945 stop_82547_timer(Adapter->tx_ring);
1949 e1000g_stop(struct e1000g *Adapter, boolean_t global)
1955 Adapter->attach_progress &= ~ATTACH_PROGRESS_INIT;
1960 e1000g_release_driver_control(&Adapter->shared);
1962 e1000g_clear_all_interrupts(Adapter);
1965 result = e1000_reset_hw(&Adapter->shared);
1969 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_INVAL_STATE);
1970 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
1973 mutex_enter(&Adapter->link_lock);
1974 Adapter->link_complete = B_FALSE;
1975 mutex_exit(&Adapter->link_lock);
1978 e1000g_tx_clean(Adapter);
1980 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK)
1981 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
1984 e1000g_rx_clean(Adapter);
1987 e1000g_release_dma_resources(Adapter);
1990 rx_data = Adapter->rx_ring->rx_data;
2001 atomic_inc_32(&Adapter->pending_rx_count);
2006 if (Adapter->link_state != LINK_STATE_UNKNOWN) {
2007 Adapter->link_state = LINK_STATE_UNKNOWN;
2008 if (!Adapter->reset_flag)
2009 mac_link_update(Adapter->mh, Adapter->link_state);
2014 e1000g_rx_clean(struct e1000g *Adapter)
2016 e1000g_rx_data_t *rx_data = Adapter->rx_ring->rx_data;
2030 e1000g_tx_clean(struct e1000g *Adapter)
2038 tx_ring = Adapter->tx_ring;
2082 E1000_WRITE_REG(&Adapter->shared, E1000_TDH(0), 0);
2083 E1000_WRITE_REG(&Adapter->shared, E1000_TDT(0), 0);
2088 e1000g_tx_drain(struct e1000g *Adapter)
2094 tx_ring = Adapter->tx_ring;
2112 e1000g_rx_drain(struct e1000g *Adapter)
2121 done = (Adapter->pending_rx_count == 0);
2133 e1000g_reset_adapter(struct e1000g *Adapter)
2136 disable_watchdog_timer(Adapter);
2137 stop_link_timer(Adapter);
2138 stop_82547_timer(Adapter->tx_ring);
2140 rw_enter(&Adapter->chip_lock, RW_WRITER);
2142 if (Adapter->stall_flag) {
2143 Adapter->stall_flag = B_FALSE;
2144 Adapter->reset_flag = B_TRUE;
2147 if (!(Adapter->e1000g_state & E1000G_STARTED)) {
2148 rw_exit(&Adapter->chip_lock);
2152 e1000g_stop(Adapter, B_FALSE);
2154 if (e1000g_start(Adapter, B_FALSE) != DDI_SUCCESS) {
2155 rw_exit(&Adapter->chip_lock);
2156 e1000g_log(Adapter, CE_WARN, "Reset failed");
2160 rw_exit(&Adapter->chip_lock);
2163 enable_watchdog_timer(Adapter);
2169 e1000g_global_reset(struct e1000g *Adapter)
2172 disable_watchdog_timer(Adapter);
2173 stop_link_timer(Adapter);
2174 stop_82547_timer(Adapter->tx_ring);
2176 rw_enter(&Adapter->chip_lock, RW_WRITER);
2178 e1000g_stop(Adapter, B_TRUE);
2180 Adapter->init_count = 0;
2182 if (e1000g_start(Adapter, B_TRUE) != DDI_SUCCESS) {
2183 rw_exit(&Adapter->chip_lock);
2184 e1000g_log(Adapter, CE_WARN, "Reset failed");
2188 rw_exit(&Adapter->chip_lock);
2191 enable_watchdog_timer(Adapter);
2206 struct e1000g *Adapter;
2209 Adapter = (struct e1000g *)(uintptr_t)arg;
2210 icr = E1000_READ_REG(&Adapter->shared, E1000_ICR);
2212 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2213 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2223 e1000g_intr_work(Adapter, icr);
2244 struct e1000g *Adapter;
2247 Adapter = (struct e1000g *)(uintptr_t)arg;
2248 icr = E1000_READ_REG(&Adapter->shared, E1000_ICR);
2250 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2251 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2261 e1000g_intr_work(Adapter, icr);
2279 e1000g_intr_work(struct e1000g *Adapter, uint32_t icr)
2282 hw = &Adapter->shared;
2283 e1000g_tx_ring_t *tx_ring = Adapter->tx_ring;
2285 Adapter->rx_pkt_cnt = 0;
2286 Adapter->tx_pkt_cnt = 0;
2288 rw_enter(&Adapter->chip_lock, RW_READER);
2290 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
2291 rw_exit(&Adapter->chip_lock);
2299 if (!(Adapter->e1000g_state & E1000G_STARTED)) {
2300 rw_exit(&Adapter->chip_lock);
2309 rx_ring = Adapter->rx_ring;
2321 rw_exit(&Adapter->chip_lock);
2323 mac_rx_ring(Adapter->mh, rx_ring->mrh,
2326 rw_exit(&Adapter->chip_lock);
2329 if (!Adapter->tx_intr_enable)
2330 e1000g_clear_tx_interrupt(Adapter);
2333 rw_enter(&Adapter->chip_lock, RW_READER);
2336 rw_exit(&Adapter->chip_lock);
2341 mac_tx_update(Adapter->mh);
2358 stop_watchdog_timer(Adapter);
2360 rw_enter(&Adapter->chip_lock, RW_WRITER);
2366 Adapter->shared.mac.get_link_status = B_TRUE;
2369 link_changed = e1000g_link_check(Adapter);
2372 e1000g_get_phy_state(Adapter);
2378 if (link_changed && !Adapter->link_complete) {
2379 if (Adapter->link_state == LINK_STATE_UP) {
2380 mutex_enter(&Adapter->link_lock);
2381 Adapter->link_complete = B_TRUE;
2382 tid = Adapter->link_tid;
2383 Adapter->link_tid = 0;
2384 mutex_exit(&Adapter->link_lock);
2389 rw_exit(&Adapter->chip_lock);
2399 if ((Adapter->link_state == LINK_STATE_DOWN) &&
2400 (Adapter->shared.mac.type == e1000_80003es2lan)) {
2404 e1000g_log(Adapter, CE_WARN,
2406 Adapter->esb2_workaround = B_TRUE;
2408 if (!Adapter->reset_flag)
2409 mac_link_update(Adapter->mh,
2410 Adapter->link_state);
2411 if (Adapter->link_state == LINK_STATE_UP)
2412 Adapter->reset_flag = B_FALSE;
2415 start_watchdog_timer(Adapter);
2420 e1000g_init_unicst(struct e1000g *Adapter)
2425 hw = &Adapter->shared;
2427 if (Adapter->init_count == 0) {
2429 Adapter->unicst_total = MAX_NUM_UNICAST_ADDRESSES;
2434 Adapter->unicst_total--;
2436 Adapter->unicst_avail = Adapter->unicst_total;
2438 for (slot = 0; slot < Adapter->unicst_total; slot++) {
2440 Adapter->unicst_addr[slot].reg.high = 0;
2441 Adapter->unicst_addr[slot].reg.low = 0;
2450 for (slot = 0; slot < Adapter->unicst_total; slot++)
2451 if (Adapter->unicst_addr[slot].mac.set == 1)
2453 Adapter->unicst_addr[slot].mac.addr, slot);
2456 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK)
2457 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2461 e1000g_unicst_set(struct e1000g *Adapter, const uint8_t *mac_addr,
2466 hw = &Adapter->shared;
2489 Adapter->unicst_addr[slot].reg.high = 0;
2490 Adapter->unicst_addr[slot].reg.low = 0;
2492 bcopy(mac_addr, Adapter->unicst_addr[slot].mac.addr,
2495 Adapter->unicst_addr[slot].mac.set = 1;
2527 e1000g_rx_setup(Adapter);
2530 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2531 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2539 multicst_add(struct e1000g *Adapter, const uint8_t *multiaddr)
2541 struct e1000_hw *hw = &Adapter->shared;
2549 e1000g_log(Adapter, CE_WARN, "Illegal multicast address");
2553 if (Adapter->mcast_count >= Adapter->mcast_max_num) {
2555 e1000g_log(Adapter, CE_WARN,
2556 "Adapter requested more than %d mcast addresses",
2557 Adapter->mcast_max_num);
2562 if (Adapter->mcast_count == Adapter->mcast_alloc_count) {
2563 old_len = Adapter->mcast_alloc_count *
2565 new_len = (Adapter->mcast_alloc_count + MCAST_ALLOC_SIZE) *
2571 e1000g_log(Adapter, CE_WARN,
2576 if (Adapter->mcast_table != NULL) {
2577 bcopy(Adapter->mcast_table, newtable, old_len);
2578 kmem_free(Adapter->mcast_table, old_len);
2580 Adapter->mcast_alloc_count += MCAST_ALLOC_SIZE;
2581 Adapter->mcast_table = newtable;
2585 &Adapter->mcast_table[Adapter->mcast_count], ETHERADDRL);
2586 Adapter->mcast_count++;
2591 e1000g_clear_interrupt(Adapter);
2594 (uint8_t *)Adapter->mcast_table, Adapter->mcast_count);
2596 e1000g_mask_interrupt(Adapter);
2598 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2599 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2608 multicst_remove(struct e1000g *Adapter, const uint8_t *multiaddr)
2610 struct e1000_hw *hw = &Adapter->shared;
2616 for (i = 0; i < Adapter->mcast_count; i++) {
2617 if (bcmp(multiaddr, &Adapter->mcast_table[i],
2619 for (i++; i < Adapter->mcast_count; i++) {
2620 Adapter->mcast_table[i - 1] =
2621 Adapter->mcast_table[i];
2623 Adapter->mcast_count--;
2628 if ((Adapter->mcast_alloc_count - Adapter->mcast_count) >
2630 old_len = Adapter->mcast_alloc_count *
2632 new_len = (Adapter->mcast_alloc_count - MCAST_ALLOC_SIZE) *
2637 bcopy(Adapter->mcast_table, newtable, new_len);
2638 kmem_free(Adapter->mcast_table, old_len);
2640 Adapter->mcast_alloc_count -= MCAST_ALLOC_SIZE;
2641 Adapter->mcast_table = newtable;
2648 e1000g_clear_interrupt(Adapter);
2651 (uint8_t *)Adapter->mcast_table, Adapter->mcast_count);
2653 e1000g_mask_interrupt(Adapter);
2655 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2656 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2664 e1000g_release_multicast(struct e1000g *Adapter)
2666 if (Adapter->mcast_table != NULL) {
2667 kmem_free(Adapter->mcast_table,
2668 Adapter->mcast_alloc_count * sizeof (struct ether_addr));
2669 Adapter->mcast_table = NULL;
2676 struct e1000g *Adapter = (struct e1000g *)arg;
2679 rw_enter(&Adapter->chip_lock, RW_WRITER);
2681 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
2686 result = (add) ? multicst_add(Adapter, addr)
2687 : multicst_remove(Adapter, addr);
2690 rw_exit(&Adapter->chip_lock);
2698 struct e1000g *Adapter = (struct e1000g *)arg;
2701 rw_enter(&Adapter->chip_lock, RW_WRITER);
2703 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
2704 rw_exit(&Adapter->chip_lock);
2708 rctl = E1000_READ_REG(&Adapter->shared, E1000_RCTL);
2716 E1000_WRITE_REG(&Adapter->shared, E1000_RCTL, rctl);
2718 Adapter->e1000g_promisc = on;
2720 rw_exit(&Adapter->chip_lock);
2722 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
2723 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
2843 e1000g_unicst_find(struct e1000g *Adapter, const uint8_t *mac_addr)
2847 for (slot = 0; slot < Adapter->unicst_total; slot++) {
2848 if ((Adapter->unicst_addr[slot].mac.set == 1) &&
2849 (bcmp(Adapter->unicst_addr[slot].mac.addr,
2866 struct e1000g *Adapter = (struct e1000g *)arg;
2869 rw_enter(&Adapter->chip_lock, RW_WRITER);
2871 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
2872 rw_exit(&Adapter->chip_lock);
2876 if (e1000g_unicst_find(Adapter, mac_addr) != -1) {
2878 rw_exit(&Adapter->chip_lock);
2882 if (Adapter->unicst_avail == 0) {
2884 rw_exit(&Adapter->chip_lock);
2889 for (slot = 0; slot < Adapter->unicst_total; slot++) {
2890 if (Adapter->unicst_addr[slot].mac.set == 0)
2893 ASSERT(slot < Adapter->unicst_total);
2895 err = e1000g_unicst_set(Adapter, mac_addr, slot);
2897 Adapter->unicst_avail--;
2899 rw_exit(&Adapter->chip_lock);
2907 struct e1000g *Adapter = (struct e1000g *)arg;
2910 rw_enter(&Adapter->chip_lock, RW_WRITER);
2912 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
2913 rw_exit(&Adapter->chip_lock);
2917 slot = e1000g_unicst_find(Adapter, mac_addr);
2919 rw_exit(&Adapter->chip_lock);
2923 ASSERT(Adapter->unicst_addr[slot].mac.set);
2926 err = e1000g_unicst_set(Adapter, NULL, slot);
2928 Adapter->unicst_avail++;
2930 rw_exit(&Adapter->chip_lock);
2959 struct e1000g *Adapter = (struct e1000g *)arg;
2960 e1000g_rx_ring_t *rx_ring = Adapter->rx_ring;
2981 if (Adapter->msi_enable)
2982 mintr->mi_ddi_handle = Adapter->htable[0];
2990 struct e1000g *Adapter = (struct e1000g *)arg;
2999 Adapter->rx_group = gh;
3001 infop->mgi_driver = (mac_group_driver_t)Adapter;
3010 mintr->mi_handle = (mac_intr_handle_t)Adapter;
3018 struct e1000g *Adapter = (struct e1000g *)arg;
3024 if (Adapter->tx_hcksum_enable)
3035 if (Adapter->lso_enable) {
3091 struct e1000g *Adapter = arg;
3092 struct e1000_hw *hw = &Adapter->shared;
3093 struct e1000_fc_info *fc = &Adapter->shared.fc;
3098 rw_enter(&Adapter->chip_lock, RW_WRITER);
3100 if (Adapter->e1000g_state & E1000G_SUSPENDED) {
3101 rw_exit(&Adapter->chip_lock);
3105 if (Adapter->loopback_mode != E1000G_LB_NONE &&
3111 rw_exit(&Adapter->chip_lock);
3121 Adapter->param_en_1000fdx = *(uint8_t *)pr_val;
3122 Adapter->param_adv_1000fdx = *(uint8_t *)pr_val;
3129 Adapter->param_en_100fdx = *(uint8_t *)pr_val;
3130 Adapter->param_adv_100fdx = *(uint8_t *)pr_val;
3137 Adapter->param_en_100hdx = *(uint8_t *)pr_val;
3138 Adapter->param_adv_100hdx = *(uint8_t *)pr_val;
3145 Adapter->param_en_10fdx = *(uint8_t *)pr_val;
3146 Adapter->param_adv_10fdx = *(uint8_t *)pr_val;
3153 Adapter->param_en_10hdx = *(uint8_t *)pr_val;
3154 Adapter->param_adv_10hdx = *(uint8_t *)pr_val;
3161 Adapter->param_adv_autoneg = *(uint8_t *)pr_val;
3187 e1000g_pch_limits(Adapter);
3188 if (e1000g_reset_link(Adapter) != DDI_SUCCESS)
3206 if (Adapter->e1000g_state & E1000G_STARTED) {
3211 cur_mtu = Adapter->default_mtu;
3221 (new_mtu > Adapter->max_mtu)) {
3227 err = mac_maxsdu_update(Adapter->mh, new_mtu);
3230 Adapter->default_mtu = new_mtu;
3231 Adapter->max_frame_size =
3238 e1000g_pch_limits(Adapter);
3239 e1000g_set_bufsize(Adapter);
3246 if (Adapter->max_frame_size >=
3248 if (Adapter->tx_desc_num_flag == 0)
3249 Adapter->tx_desc_num =
3252 if (Adapter->rx_desc_num_flag == 0)
3253 Adapter->rx_desc_num =
3256 if (Adapter->tx_buf_num_flag == 0)
3257 Adapter->tx_freelist_num =
3260 if (Adapter->rx_buf_num_flag == 0)
3261 Adapter->rx_freelist_limit =
3264 if (Adapter->tx_desc_num_flag == 0)
3265 Adapter->tx_desc_num =
3268 if (Adapter->rx_desc_num_flag == 0)
3269 Adapter->rx_desc_num =
3272 if (Adapter->tx_buf_num_flag == 0)
3273 Adapter->tx_freelist_num =
3276 if (Adapter->rx_buf_num_flag == 0)
3277 Adapter->rx_freelist_limit =
3283 err = e1000g_set_priv_prop(Adapter, pr_name,
3290 rw_exit(&Adapter->chip_lock);
3298 struct e1000g *Adapter = arg;
3299 struct e1000_fc_info *fc = &Adapter->shared.fc;
3307 bcopy(&Adapter->link_duplex, pr_val,
3312 tmp = Adapter->link_speed * 1000000ull;
3316 *(uint8_t *)pr_val = Adapter->param_adv_autoneg;
3337 *(uint8_t *)pr_val = Adapter->param_adv_1000fdx;
3340 *(uint8_t *)pr_val = Adapter->param_en_1000fdx;
3343 *(uint8_t *)pr_val = Adapter->param_adv_1000hdx;
3346 *(uint8_t *)pr_val = Adapter->param_en_1000hdx;
3349 *(uint8_t *)pr_val = Adapter->param_adv_100fdx;
3352 *(uint8_t *)pr_val = Adapter->param_en_100fdx;
3355 *(uint8_t *)pr_val = Adapter->param_adv_100hdx;
3358 *(uint8_t *)pr_val = Adapter->param_en_100hdx;
3361 *(uint8_t *)pr_val = Adapter->param_adv_10fdx;
3364 *(uint8_t *)pr_val = Adapter->param_en_10fdx;
3367 *(uint8_t *)pr_val = Adapter->param_adv_10hdx;
3370 *(uint8_t *)pr_val = Adapter->param_en_10hdx;
3374 *(uint8_t *)pr_val = Adapter->param_adv_100t4;
3377 err = e1000g_get_priv_prop(Adapter, pr_name,
3392 struct e1000g *Adapter = arg;
3393 struct e1000_hw *hw = &Adapter->shared;
3414 ((Adapter->phy_ext_status &
3416 (Adapter->phy_ext_status &
3426 ((Adapter->phy_status & MII_SR_100X_FD_CAPS) ||
3427 (Adapter->phy_status & MII_SR_100T2_FD_CAPS))
3437 ((Adapter->phy_status & MII_SR_100X_HD_CAPS) ||
3438 (Adapter->phy_status & MII_SR_100T2_HD_CAPS))
3448 (Adapter->phy_status & MII_SR_10T_FD_CAPS) ? 1 : 0);
3457 (Adapter->phy_status & MII_SR_10T_HD_CAPS) ? 1 : 0);
3471 (Adapter->phy_status & MII_SR_AUTONEG_CAPS)
3481 struct e1000_mac_info *mac = &Adapter->shared.mac;
3482 struct e1000_phy_info *phy = &Adapter->shared.phy;
3491 max = Adapter->max_mtu;
3538 e1000g_set_priv_prop(struct e1000g *Adapter, const char *pr_name,
3543 struct e1000_hw *hw = &Adapter->shared;
3555 Adapter->tx_bcopy_thresh = (uint32_t)result;
3568 Adapter->tx_intr_enable = (result == 1) ?
3570 if (Adapter->tx_intr_enable)
3571 e1000g_mask_tx_interrupt(Adapter);
3573 e1000g_clear_tx_interrupt(Adapter);
3575 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3576 ddi_fm_service_impact(Adapter->dip,
3593 Adapter->tx_intr_delay = (uint32_t)result;
3594 E1000_WRITE_REG(hw, E1000_TIDV, Adapter->tx_intr_delay);
3596 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3597 ddi_fm_service_impact(Adapter->dip,
3614 Adapter->tx_intr_abs_delay = (uint32_t)result;
3616 Adapter->tx_intr_abs_delay);
3618 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3619 ddi_fm_service_impact(Adapter->dip,
3636 Adapter->rx_bcopy_thresh = (uint32_t)result;
3649 Adapter->rx_limit_onintr = (uint32_t)result;
3662 Adapter->rx_intr_delay = (uint32_t)result;
3663 E1000_WRITE_REG(hw, E1000_RDTR, Adapter->rx_intr_delay);
3665 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3666 ddi_fm_service_impact(Adapter->dip,
3683 Adapter->rx_intr_abs_delay = (uint32_t)result;
3685 Adapter->rx_intr_abs_delay);
3687 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3688 ddi_fm_service_impact(Adapter->dip,
3706 Adapter->intr_throttling_rate =
3709 Adapter->intr_throttling_rate);
3711 Adapter->osdep.reg_handle) != DDI_FM_OK) {
3712 ddi_fm_service_impact(Adapter->dip,
3731 Adapter->intr_adaptive = (result == 1) ?
3743 e1000g_get_priv_prop(struct e1000g *Adapter, const char *pr_name,
3750 value = Adapter->param_adv_pause;
3755 value = Adapter->param_adv_asym_pause;
3760 value = Adapter->tx_bcopy_thresh;
3765 value = Adapter->tx_intr_enable;
3770 value = Adapter->tx_intr_delay;
3775 value = Adapter->tx_intr_abs_delay;
3780 value = Adapter->rx_bcopy_thresh;
3785 value = Adapter->rx_limit_onintr;
3790 value = Adapter->rx_intr_delay;
3795 value = Adapter->rx_intr_abs_delay;
3800 value = Adapter->intr_throttling_rate;
3805 value = Adapter->intr_adaptive;
3828 e1000g_get_conf(struct e1000g *Adapter)
3830 struct e1000_hw *hw = &Adapter->shared;
3838 if (Adapter->max_frame_size >= FRAME_SIZE_UPTO_4K) {
3849 Adapter->tx_desc_num_flag =
3850 e1000g_get_prop(Adapter, "NumTxDescriptors",
3854 Adapter->tx_desc_num = propval;
3859 Adapter->rx_desc_num_flag =
3860 e1000g_get_prop(Adapter, "NumRxDescriptors",
3864 Adapter->rx_desc_num = propval;
3869 Adapter->rx_buf_num_flag =
3870 e1000g_get_prop(Adapter, "NumRxFreeList",
3874 Adapter->rx_freelist_limit = propval;
3879 Adapter->tx_buf_num_flag =
3880 e1000g_get_prop(Adapter, "NumTxPacketList",
3884 Adapter->tx_freelist_num = propval;
3890 (void) e1000g_get_prop(Adapter, "FlowControl",
3900 (void) e1000g_get_prop(Adapter, "MaxNumReceivePackets",
3903 Adapter->rx_limit_onintr = propval;
3908 (void) e1000g_get_prop(Adapter, "SetMasterSlave",
3917 (void) e1000g_get_prop(Adapter, "TbiCompatibilityEnable",
3925 (void) e1000g_get_prop(Adapter, "MSIEnable",
3927 Adapter->msi_enable = (propval == 1);
3932 (void) e1000g_get_prop(Adapter, "intr_throttling_rate",
3935 Adapter->intr_throttling_rate = propval;
3941 (void) e1000g_get_prop(Adapter, "intr_adaptive", 0, 1, 1,
3943 Adapter->intr_adaptive = (propval == 1);
3948 (void) e1000g_get_prop(Adapter, "tx_hcksum_enable",
3950 Adapter->tx_hcksum_enable = (propval == 1);
3988 Adapter->tx_hcksum_enable = B_FALSE;
3996 (void) e1000g_get_prop(Adapter, "lso_enable",
3998 Adapter->lso_enable = (propval == 1);
4003 if (Adapter->lso_enable)
4004 Adapter->lso_premature_issue = B_TRUE;
4012 Adapter->lso_enable = B_FALSE;
4015 if (!Adapter->tx_hcksum_enable) {
4016 Adapter->lso_premature_issue = B_FALSE;
4017 Adapter->lso_enable = B_FALSE;
4025 (void) e1000g_get_prop(Adapter, "mem_workaround_82546",
4027 Adapter->mem_workaround_82546 = (propval == 1);
4032 (void) e1000g_get_prop(Adapter, "mcast_max_num",
4035 Adapter->mcast_max_num = propval;
4052 e1000g_get_prop(struct e1000g *Adapter, /* point to per-adapter structure */
4067 if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, Adapter->dip,
4070 if (Adapter->instance < nprops) {
4071 propval = props[Adapter->instance];
4075 E1000G_DEBUGLOG_2(Adapter, E1000G_INFO_LEVEL,
4095 E1000G_DEBUGLOG_2(Adapter, E1000G_INFO_LEVEL,
4102 E1000G_DEBUGLOG_2(Adapter, E1000G_INFO_LEVEL,
4112 e1000g_link_check(struct e1000g *Adapter)
4119 hw = &Adapter->shared;
4121 if (e1000g_link_up(Adapter)) {
4125 if (Adapter->link_state != LINK_STATE_UP) {
4127 Adapter->link_speed = speed;
4128 Adapter->link_duplex = duplex;
4129 Adapter->link_state = LINK_STATE_UP;
4132 if (Adapter->link_speed == SPEED_1000)
4133 Adapter->stall_threshold = TX_STALL_TIME_2S;
4135 Adapter->stall_threshold = TX_STALL_TIME_8S;
4137 Adapter->tx_link_down_timeout = 0;
4149 Adapter->smartspeed = 0;
4151 if (Adapter->link_state != LINK_STATE_DOWN) {
4152 Adapter->link_speed = 0;
4153 Adapter->link_duplex = 0;
4154 Adapter->link_state = LINK_STATE_DOWN;
4170 e1000g_smartspeed(Adapter);
4173 if (Adapter->e1000g_state & E1000G_STARTED) {
4174 if (Adapter->tx_link_down_timeout <
4176 Adapter->tx_link_down_timeout++;
4177 } else if (Adapter->tx_link_down_timeout ==
4179 e1000g_tx_clean(Adapter);
4180 Adapter->tx_link_down_timeout++;
4185 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK)
4186 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
4195 e1000g_reset_link(struct e1000g *Adapter)
4202 mac = &Adapter->shared.mac;
4203 phy = &Adapter->shared.phy;
4204 hw = &Adapter->shared;
4210 if (Adapter->param_adv_autoneg == 1) {
4217 if (Adapter->param_adv_1000fdx == 1)
4220 if (Adapter->param_adv_100fdx == 1)
4223 if (Adapter->param_adv_100hdx == 1)
4226 if (Adapter->param_adv_10fdx == 1)
4229 if (Adapter->param_adv_10hdx == 1)
4241 if (Adapter->param_adv_100fdx == 1)
4243 else if (Adapter->param_adv_100hdx == 1)
4245 else if (Adapter->param_adv_10fdx == 1)
4247 else if (Adapter->param_adv_10hdx == 1)
4255 e1000g_log(Adapter, CE_WARN,
4263 return (e1000_setup_link(&Adapter->shared));
4267 e1000g_timer_tx_resched(struct e1000g *Adapter)
4269 e1000g_tx_ring_t *tx_ring = Adapter->tx_ring;
4271 rw_enter(&Adapter->chip_lock, RW_READER);
4276 (Adapter->e1000g_state & E1000G_STARTED) &&
4279 mac_tx_update(Adapter->mh);
4284 rw_exit(&Adapter->chip_lock);
4290 struct e1000g *Adapter = (struct e1000g *)ws;
4295 hw = &Adapter->shared;
4297 if (Adapter->e1000g_state & E1000G_ERROR) {
4298 rw_enter(&Adapter->chip_lock, RW_WRITER);
4299 Adapter->e1000g_state &= ~E1000G_ERROR;
4300 rw_exit(&Adapter->chip_lock);
4302 Adapter->reset_count++;
4303 if (e1000g_global_reset(Adapter)) {
4304 ddi_fm_service_impact(Adapter->dip,
4306 e1000g_timer_tx_resched(Adapter);
4308 ddi_fm_service_impact(Adapter->dip,
4313 if (e1000g_stall_check(Adapter)) {
4314 E1000G_DEBUGLOG_0(Adapter, E1000G_INFO_LEVEL,
4316 e1000g_fm_ereport(Adapter, DDI_FM_DEVICE_STALL);
4317 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_LOST);
4318 Adapter->reset_count++;
4319 if (e1000g_reset_adapter(Adapter)) {
4320 ddi_fm_service_impact(Adapter->dip,
4322 e1000g_timer_tx_resched(Adapter);
4328 rw_enter(&Adapter->chip_lock, RW_READER);
4329 if (Adapter->link_complete)
4330 link_changed = e1000g_link_check(Adapter);
4331 rw_exit(&Adapter->chip_lock);
4334 if (!Adapter->reset_flag &&
4335 (Adapter->e1000g_state & E1000G_STARTED) &&
4336 !(Adapter->e1000g_state & E1000G_SUSPENDED))
4337 mac_link_update(Adapter->mh, Adapter->link_state);
4338 if (Adapter->link_state == LINK_STATE_UP)
4339 Adapter->reset_flag = B_FALSE;
4345 if (Adapter->esb2_workaround) {
4346 Adapter->esb2_workaround = B_FALSE;
4347 (void) e1000g_reset_adapter(Adapter);
4385 ((Adapter->link_speed == SPEED_100) ||
4386 (Adapter->link_speed == SPEED_10))) {
4394 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK)
4395 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
4397 e1000g_timer_tx_resched(Adapter);
4399 restart_watchdog_timer(Adapter);
4413 struct e1000g *Adapter = (struct e1000g *)arg;
4415 mutex_enter(&Adapter->link_lock);
4416 Adapter->link_complete = B_TRUE;
4417 Adapter->link_tid = 0;
4418 mutex_exit(&Adapter->link_lock);
4428 e1000g_force_speed_duplex(struct e1000g *Adapter)
4432 struct e1000_mac_info *mac = &Adapter->shared.mac;
4433 struct e1000_phy_info *phy = &Adapter->shared.phy;
4438 (void) e1000g_get_prop(Adapter, "ForceSpeedDuplex",
4483 (void) e1000g_get_prop(Adapter, "AutoNegAdvertised",
4497 e1000g_get_max_frame_size(struct e1000g *Adapter)
4504 (void) e1000g_get_prop(Adapter, "MaxFrameSize", 0, 3, 0,
4509 Adapter->default_mtu = ETHERMTU;
4512 Adapter->default_mtu = FRAME_SIZE_UPTO_4K -
4516 Adapter->default_mtu = FRAME_SIZE_UPTO_8K -
4520 Adapter->default_mtu = FRAME_SIZE_UPTO_16K -
4524 Adapter->default_mtu = ETHERMTU;
4532 if (Adapter->default_mtu > Adapter->max_mtu)
4533 Adapter->default_mtu = Adapter->max_mtu;
4535 Adapter->max_frame_size = e1000g_mtu2maxframe(Adapter->default_mtu);
4545 e1000g_pch_limits(struct e1000g *Adapter)
4547 struct e1000_hw *hw = &Adapter->shared;
4554 if (Adapter->max_frame_size > DEFAULT_FRAME_SIZE) {
4558 Adapter->param_adv_autoneg = 1;
4559 Adapter->param_adv_1000fdx = 1;
4561 Adapter->param_adv_100fdx = 0;
4562 Adapter->param_adv_100hdx = 0;
4563 Adapter->param_adv_10fdx = 0;
4564 Adapter->param_adv_10hdx = 0;
4566 e1000g_param_sync(Adapter);
4584 arm_watchdog_timer(struct e1000g *Adapter)
4586 Adapter->watchdog_tid =
4588 (void *)Adapter, 1 * drv_usectohz(1000000));
4593 enable_watchdog_timer(struct e1000g *Adapter)
4595 mutex_enter(&Adapter->watchdog_lock);
4597 if (!Adapter->watchdog_timer_enabled) {
4598 Adapter->watchdog_timer_enabled = B_TRUE;
4599 Adapter->watchdog_timer_started = B_TRUE;
4600 arm_watchdog_timer(Adapter);
4603 mutex_exit(&Adapter->watchdog_lock);
4607 disable_watchdog_timer(struct e1000g *Adapter)
4611 mutex_enter(&Adapter->watchdog_lock);
4613 Adapter->watchdog_timer_enabled = B_FALSE;
4614 Adapter->watchdog_timer_started = B_FALSE;
4615 tid = Adapter->watchdog_tid;
4616 Adapter->watchdog_tid = 0;
4618 mutex_exit(&Adapter->watchdog_lock);
4625 start_watchdog_timer(struct e1000g *Adapter)
4627 mutex_enter(&Adapter->watchdog_lock);
4629 if (Adapter->watchdog_timer_enabled) {
4630 if (!Adapter->watchdog_timer_started) {
4631 Adapter->watchdog_timer_started = B_TRUE;
4632 arm_watchdog_timer(Adapter);
4636 mutex_exit(&Adapter->watchdog_lock);
4640 restart_watchdog_timer(struct e1000g *Adapter)
4642 mutex_enter(&Adapter->watchdog_lock);
4644 if (Adapter->watchdog_timer_started)
4645 arm_watchdog_timer(Adapter);
4647 mutex_exit(&Adapter->watchdog_lock);
4651 stop_watchdog_timer(struct e1000g *Adapter)
4655 mutex_enter(&Adapter->watchdog_lock);
4657 Adapter->watchdog_timer_started = B_FALSE;
4658 tid = Adapter->watchdog_tid;
4659 Adapter->watchdog_tid = 0;
4661 mutex_exit(&Adapter->watchdog_lock);
4668 stop_link_timer(struct e1000g *Adapter)
4673 mutex_enter(&Adapter->link_lock);
4675 tid = Adapter->link_tid;
4676 Adapter->link_tid = 0;
4678 mutex_exit(&Adapter->link_lock);
4703 e1000g_clear_interrupt(struct e1000g *Adapter)
4705 E1000_WRITE_REG(&Adapter->shared, E1000_IMC,
4710 e1000g_mask_interrupt(struct e1000g *Adapter)
4712 E1000_WRITE_REG(&Adapter->shared, E1000_IMS,
4715 if (Adapter->tx_intr_enable)
4716 e1000g_mask_tx_interrupt(Adapter);
4723 e1000g_clear_all_interrupts(struct e1000g *Adapter)
4725 E1000_WRITE_REG(&Adapter->shared, E1000_IMC, 0xffffffff);
4729 e1000g_mask_tx_interrupt(struct e1000g *Adapter)
4731 E1000_WRITE_REG(&Adapter->shared, E1000_IMS, E1000_IMS_TXDW);
4735 e1000g_clear_tx_interrupt(struct e1000g *Adapter)
4737 E1000_WRITE_REG(&Adapter->shared, E1000_IMC, E1000_IMS_TXDW);
4741 e1000g_smartspeed(struct e1000g *Adapter)
4743 struct e1000_hw *hw = &Adapter->shared;
4760 if (Adapter->smartspeed == 0) {
4793 Adapter->smartspeed++;
4811 } else if (Adapter->smartspeed == E1000_SMARTSPEED_DOWNSHIFT) {
4845 if (Adapter->smartspeed++ == E1000_SMARTSPEED_MAX)
4846 Adapter->smartspeed = 0;
4875 e1000g_stall_check(struct e1000g *Adapter)
4879 tx_ring = Adapter->tx_ring;
4881 if (Adapter->link_state != LINK_STATE_UP)
4886 if (Adapter->stall_flag)
5090 e1000g_loopback_ioctl(struct e1000g *Adapter, struct iocblk *iocp, mblk_t *mp)
5099 hw = &Adapter->shared;
5106 "Loopback is not supported on e1000g%d", Adapter->instance);
5119 rw_enter(&Adapter->chip_lock, RW_WRITER);
5120 e1000g_get_phy_state(Adapter);
5129 e1000g_get_phy_state(Adapter);
5130 rw_exit(&Adapter->chip_lock);
5133 if ((Adapter->phy_ext_status & IEEE_ESR_1000T_FD_CAPS) ||
5134 (Adapter->phy_ext_status & IEEE_ESR_1000X_FD_CAPS) ||
5146 if ((Adapter->phy_status & MII_SR_100X_FD_CAPS) ||
5147 (Adapter->phy_status & MII_SR_100T2_FD_CAPS))
5149 if (Adapter->phy_status & MII_SR_10T_FD_CAPS)
5158 if ((Adapter->phy_ext_status & IEEE_ESR_1000T_FD_CAPS) ||
5159 (Adapter->phy_ext_status & IEEE_ESR_1000X_FD_CAPS) ||
5171 if ((Adapter->phy_status & MII_SR_100X_FD_CAPS) ||
5172 (Adapter->phy_status & MII_SR_100T2_FD_CAPS))
5174 if (Adapter->phy_status & MII_SR_10T_FD_CAPS)
5184 if ((Adapter->phy_ext_status & IEEE_ESR_1000T_FD_CAPS) ||
5185 (Adapter->phy_ext_status & IEEE_ESR_1000X_FD_CAPS) ||
5197 if ((Adapter->phy_status & MII_SR_100X_FD_CAPS) ||
5198 (Adapter->phy_status & MII_SR_100T2_FD_CAPS))
5200 if (Adapter->phy_status & MII_SR_10T_FD_CAPS)
5210 *lbmp = Adapter->loopback_mode;
5219 if (!e1000g_set_loopback_mode(Adapter, *lbmp))
5227 if (e1000g_check_acc_handle(Adapter->osdep.reg_handle) != DDI_FM_OK) {
5228 ddi_fm_service_impact(Adapter->dip, DDI_SERVICE_DEGRADED);
5261 e1000g_set_loopback_mode(struct e1000g *Adapter, uint32_t mode)
5267 if (mode == Adapter->loopback_mode)
5270 hw = &Adapter->shared;
5273 Adapter->loopback_mode = mode;
5278 (void) e1000g_reset_adapter(Adapter);
5285 rw_enter(&Adapter->chip_lock, RW_WRITER);
5289 rw_exit(&Adapter->chip_lock);
5293 e1000g_set_external_loopback_1000(Adapter);
5297 e1000g_set_external_loopback_100(Adapter);
5301 e1000g_set_external_loopback_10(Adapter);
5305 e1000g_set_internal_loopback(Adapter);
5311 rw_exit(&Adapter->chip_lock);
5317 rw_enter(&Adapter->chip_lock, RW_WRITER);
5319 link_up = e1000g_link_up(Adapter);
5321 rw_exit(&Adapter->chip_lock);
5324 E1000G_DEBUGLOG_0(Adapter, E1000G_INFO_LEVEL,
5328 E1000G_DEBUGLOG_0(Adapter, E1000G_INFO_LEVEL,
5330 (void) e1000g_reset_adapter(Adapter);
5338 Adapter->loopback_mode = E1000G_LB_NONE;
5342 (void) e1000g_reset_adapter(Adapter);
5345 E1000G_DEBUGLOG_0(Adapter, E1000G_INFO_LEVEL,
5361 e1000g_set_internal_loopback(struct e1000g *Adapter)
5370 hw = &Adapter->shared;
5532 e1000g_set_external_loopback_1000(struct e1000g *Adapter)
5542 hw = &Adapter->shared;
5631 Adapter->param_adv_autoneg = 1;
5632 Adapter->param_adv_1000fdx = 1;
5633 (void) e1000g_reset_link(Adapter);
5639 e1000g_set_external_loopback_100(struct e1000g *Adapter)
5645 hw = &Adapter->shared;
5676 e1000g_set_external_loopback_10(struct e1000g *Adapter)
5682 hw = &Adapter->shared;
5714 e1000g_find_mac_address(struct e1000g *Adapter)
5716 struct e1000_hw *hw = &Adapter->shared;
5732 err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, Adapter->dip,
5747 if (ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, Adapter->dip, 0,
5764 err = ddi_prop_lookup_byte_array(DDI_DEV_T_ANY, Adapter->dip,
5785 e1000g_add_intrs(struct e1000g *Adapter)
5791 devinfo = Adapter->dip;
5797 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
5809 if (Adapter->shared.mac.type < e1000_82571)
5810 Adapter->msi_enable = B_FALSE;
5812 if ((intr_types & DDI_INTR_TYPE_MSI) && Adapter->msi_enable) {
5813 rc = e1000g_intr_add(Adapter, DDI_INTR_TYPE_MSI);
5817 E1000G_DEBUGLOG_0(Adapter, E1000G_WARN_LEVEL,
5820 Adapter->intr_type = DDI_INTR_TYPE_MSI;
5824 if ((Adapter->intr_type == 0) &&
5826 rc = e1000g_intr_add(Adapter, DDI_INTR_TYPE_FIXED);
5829 E1000G_DEBUGLOG_0(Adapter, E1000G_WARN_LEVEL,
5834 Adapter->intr_type = DDI_INTR_TYPE_FIXED;
5837 if (Adapter->intr_type == 0) {
5838 E1000G_DEBUGLOG_0(Adapter, E1000G_WARN_LEVEL,
5850 e1000g_intr_add(struct e1000g *Adapter, int intr_type)
5858 devinfo = Adapter->dip;
5863 E1000G_DEBUGLOG_2(Adapter, E1000G_WARN_LEVEL,
5872 E1000G_DEBUGLOG_2(Adapter, E1000G_WARN_LEVEL,
5880 E1000G_DEBUGLOG_2(Adapter, E1000G_WARN_LEVEL,
5886 Adapter->intr_size = count * sizeof (ddi_intr_handle_t);
5887 Adapter->htable = kmem_alloc(Adapter->intr_size, KM_SLEEP);
5893 rc = ddi_intr_alloc(devinfo, Adapter->htable, intr_type, inum,
5897 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
5900 kmem_free(Adapter->htable, Adapter->intr_size);
5906 E1000G_DEBUGLOG_2(Adapter, E1000G_WARN_LEVEL,
5911 Adapter->intr_cnt = actual;
5914 rc = ddi_intr_get_pri(Adapter->htable[0], &Adapter->intr_pri);
5917 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
5922 (void) ddi_intr_free(Adapter->htable[y]);
5924 kmem_free(Adapter->htable, Adapter->intr_size);
5934 if (Adapter->shared.mac.type < e1000_82571)
5941 rc = ddi_intr_add_handler(Adapter->htable[x],
5942 intr_handler, (caddr_t)Adapter, NULL);
5945 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
5951 Adapter->htable[y]);
5955 (void) ddi_intr_free(Adapter->htable[y]);
5957 kmem_free(Adapter->htable, Adapter->intr_size);
5962 rc = ddi_intr_get_cap(Adapter->htable[0], &Adapter->intr_cap);
5965 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
5970 (void) ddi_intr_remove_handler(Adapter->htable[y]);
5971 (void) ddi_intr_free(Adapter->htable[y]);
5974 kmem_free(Adapter->htable, Adapter->intr_size);
5982 e1000g_rem_intrs(struct e1000g *Adapter)
5987 for (x = 0; x < Adapter->intr_cnt; x++) {
5988 rc = ddi_intr_remove_handler(Adapter->htable[x]);
5990 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
5995 rc = ddi_intr_free(Adapter->htable[x]);
5997 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6003 kmem_free(Adapter->htable, Adapter->intr_size);
6009 e1000g_enable_intrs(struct e1000g *Adapter)
6015 if (Adapter->intr_cap & DDI_INTR_FLAG_BLOCK) {
6017 rc = ddi_intr_block_enable(Adapter->htable,
6018 Adapter->intr_cnt);
6020 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6026 for (x = 0; x < Adapter->intr_cnt; x++) {
6027 rc = ddi_intr_enable(Adapter->htable[x]);
6029 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6040 e1000g_disable_intrs(struct e1000g *Adapter)
6046 if (Adapter->intr_cap & DDI_INTR_FLAG_BLOCK) {
6047 rc = ddi_intr_block_disable(Adapter->htable,
6048 Adapter->intr_cnt);
6050 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6055 for (x = 0; x < Adapter->intr_cnt; x++) {
6056 rc = ddi_intr_disable(Adapter->htable[x]);
6058 E1000G_DEBUGLOG_1(Adapter, E1000G_WARN_LEVEL,
6072 e1000g_get_phy_state(struct e1000g *Adapter)
6074 struct e1000_hw *hw = &Adapter->shared;
6077 (void) e1000_read_phy_reg(hw, PHY_CONTROL, &Adapter->phy_ctrl);
6078 (void) e1000_read_phy_reg(hw, PHY_STATUS, &Adapter->phy_status);
6080 &Adapter->phy_an_adv);
6082 &Adapter->phy_an_exp);
6084 &Adapter->phy_ext_status);
6086 &Adapter->phy_1000t_ctrl);
6088 &Adapter->phy_1000t_status);
6090 &Adapter->phy_lp_able);
6092 Adapter->param_autoneg_cap =
6093 (Adapter->phy_status & MII_SR_AUTONEG_CAPS) ? 1 : 0;
6094 Adapter->param_pause_cap =
6095 (Adapter->phy_an_adv & NWAY_AR_PAUSE) ? 1 : 0;
6096 Adapter->param_asym_pause_cap =
6097 (Adapter->phy_an_adv & NWAY_AR_ASM_DIR) ? 1 : 0;
6098 Adapter->param_1000fdx_cap =
6099 ((Adapter->phy_ext_status & IEEE_ESR_1000T_FD_CAPS) ||
6100 (Adapter->phy_ext_status & IEEE_ESR_1000X_FD_CAPS)) ? 1 : 0;
6101 Adapter->param_1000hdx_cap =
6102 ((Adapter->phy_ext_status & IEEE_ESR_1000T_HD_CAPS) ||
6103 (Adapter->phy_ext_status & IEEE_ESR_1000X_HD_CAPS)) ? 1 : 0;
6104 Adapter->param_100t4_cap =
6105 (Adapter->phy_status & MII_SR_100T4_CAPS) ? 1 : 0;
6106 Adapter->param_100fdx_cap =
6107 ((Adapter->phy_status & MII_SR_100X_FD_CAPS) ||
6108 (Adapter->phy_status & MII_SR_100T2_FD_CAPS)) ? 1 : 0;
6109 Adapter->param_100hdx_cap =
6110 ((Adapter->phy_status & MII_SR_100X_HD_CAPS) ||
6111 (Adapter->phy_status & MII_SR_100T2_HD_CAPS)) ? 1 : 0;
6112 Adapter->param_10fdx_cap =
6113 (Adapter->phy_status & MII_SR_10T_FD_CAPS) ? 1 : 0;
6114 Adapter->param_10hdx_cap =
6115 (Adapter->phy_status & MII_SR_10T_HD_CAPS) ? 1 : 0;
6117 Adapter->param_adv_autoneg = hw->mac.autoneg;
6118 Adapter->param_adv_pause =
6119 (Adapter->phy_an_adv & NWAY_AR_PAUSE) ? 1 : 0;
6120 Adapter->param_adv_asym_pause =
6121 (Adapter->phy_an_adv & NWAY_AR_ASM_DIR) ? 1 : 0;
6122 Adapter->param_adv_1000hdx =
6123 (Adapter->phy_1000t_ctrl & CR_1000T_HD_CAPS) ? 1 : 0;
6124 Adapter->param_adv_100t4 =
6125 (Adapter->phy_an_adv & NWAY_AR_100T4_CAPS) ? 1 : 0;
6126 if (Adapter->param_adv_autoneg == 1) {
6127 Adapter->param_adv_1000fdx =
6128 (Adapter->phy_1000t_ctrl & CR_1000T_FD_CAPS)
6130 Adapter->param_adv_100fdx =
6131 (Adapter->phy_an_adv & NWAY_AR_100TX_FD_CAPS)
6133 Adapter->param_adv_100hdx =
6134 (Adapter->phy_an_adv & NWAY_AR_100TX_HD_CAPS)
6136 Adapter->param_adv_10fdx =
6137 (Adapter->phy_an_adv & NWAY_AR_10T_FD_CAPS) ? 1 : 0;
6138 Adapter->param_adv_10hdx =
6139 (Adapter->phy_an_adv & NWAY_AR_10T_HD_CAPS) ? 1 : 0;
6142 Adapter->param_lp_autoneg =
6143 (Adapter->phy_an_exp & NWAY_ER_LP_NWAY_CAPS) ? 1 : 0;
6144 Adapter->param_lp_pause =
6145 (Adapter->phy_lp_able & NWAY_LPAR_PAUSE) ? 1 : 0;
6146 Adapter->param_lp_asym_pause =
6147 (Adapter->phy_lp_able & NWAY_LPAR_ASM_DIR) ? 1 : 0;
6148 Adapter->param_lp_1000fdx =
6149 (Adapter->phy_1000t_status & SR_1000T_LP_FD_CAPS) ? 1 : 0;
6150 Adapter->param_lp_1000hdx =
6151 (Adapter->phy_1000t_status & SR_1000T_LP_HD_CAPS) ? 1 : 0;
6152 Adapter->param_lp_100t4 =
6153 (Adapter->phy_lp_able & NWAY_LPAR_100T4_CAPS) ? 1 : 0;
6154 Adapter->param_lp_100fdx =
6155 (Adapter->phy_lp_able & NWAY_LPAR_100TX_FD_CAPS) ? 1 : 0;
6156 Adapter->param_lp_100hdx =
6157 (Adapter->phy_lp_able & NWAY_LPAR_100TX_HD_CAPS) ? 1 : 0;
6158 Adapter->param_lp_10fdx =
6159 (Adapter->phy_lp_able & NWAY_LPAR_10T_FD_CAPS) ? 1 : 0;
6160 Adapter->param_lp_10hdx =
6161 (Adapter->phy_lp_able & NWAY_LPAR_10T_HD_CAPS) ? 1 : 0;
6167 Adapter->param_autoneg_cap = 0;
6168 Adapter->param_pause_cap = 1;
6169 Adapter->param_asym_pause_cap = 1;
6170 Adapter->param_1000fdx_cap = 1;
6171 Adapter->param_1000hdx_cap = 0;
6172 Adapter->param_100t4_cap = 0;
6173 Adapter->param_100fdx_cap = 0;
6174 Adapter->param_100hdx_cap = 0;
6175 Adapter->param_10fdx_cap = 0;
6176 Adapter->param_10hdx_cap = 0;
6178 Adapter->param_adv_autoneg = 0;
6179 Adapter->param_adv_pause = 1;
6180 Adapter->param_adv_asym_pause = 1;
6181 Adapter->param_adv_1000fdx = 1;
6182 Adapter->param_adv_1000hdx = 0;
6183 Adapter->param_adv_100t4 = 0;
6184 Adapter->param_adv_100fdx = 0;
6185 Adapter->param_adv_100hdx = 0;
6186 Adapter->param_adv_10fdx = 0;
6187 Adapter->param_adv_10hdx = 0;
6189 Adapter->param_lp_autoneg = 0;
6190 Adapter->param_lp_pause = 0;
6191 Adapter->param_lp_asym_pause = 0;
6192 Adapter->param_lp_1000fdx = 0;
6193 Adapter->param_lp_1000hdx = 0;
6194 Adapter->param_lp_100t4 = 0;
6195 Adapter->param_lp_100fdx = 0;
6196 Adapter->param_lp_100hdx = 0;
6197 Adapter->param_lp_10fdx = 0;
6198 Adapter->param_lp_10hdx = 0;
6241 e1000g_fm_init(struct e1000g *Adapter)
6247 if (Adapter->fm_capabilities & DDI_FM_ACCCHK_CAPABLE) {
6253 if (Adapter->fm_capabilities & DDI_FM_DMACHK_CAPABLE) {
6261 if (Adapter->fm_capabilities) {
6264 ddi_fm_init(Adapter->dip, &Adapter->fm_capabilities, &iblk);
6269 if (DDI_FM_EREPORT_CAP(Adapter->fm_capabilities) ||
6270 DDI_FM_ERRCB_CAP(Adapter->fm_capabilities))
6271 pci_ereport_setup(Adapter->dip);
6276 if (DDI_FM_ERRCB_CAP(Adapter->fm_capabilities))
6277 ddi_fm_handler_register(Adapter->dip,
6278 e1000g_fm_error_cb, (void*) Adapter);
6283 e1000g_fm_fini(struct e1000g *Adapter)
6286 if (Adapter->fm_capabilities) {
6291 if (DDI_FM_EREPORT_CAP(Adapter->fm_capabilities) ||
6292 DDI_FM_ERRCB_CAP(Adapter->fm_capabilities))
6293 pci_ereport_teardown(Adapter->dip);
6298 if (DDI_FM_ERRCB_CAP(Adapter->fm_capabilities))
6299 ddi_fm_handler_unregister(Adapter->dip);
6303 ddi_fm_fini(Adapter->dip);
6304 if (Adapter->priv_dip != NULL) {
6305 DEVI(Adapter->priv_dip)->devi_fmhdl = NULL;
6312 e1000g_fm_ereport(struct e1000g *Adapter, char *detail)
6319 if (DDI_FM_EREPORT_CAP(Adapter->fm_capabilities)) {
6320 ddi_fm_ereport_post(Adapter->dip, buf, ena, DDI_NOSLEEP,
6338 struct e1000g *Adapter;
6340 Adapter = (struct e1000g *)ddi_get_driver_private(devinfo);
6342 if (Adapter == NULL)
6345 e1000g_clear_all_interrupts(Adapter);
6347 (void) e1000_reset_hw(&Adapter->shared);
6350 E1000_WRITE_REG(&Adapter->shared, E1000_TDH(0), 0);
6351 E1000_WRITE_REG(&Adapter->shared, E1000_TDT(0), 0);
6354 E1000_WRITE_REG(&Adapter->shared, E1000_RDH(0), 0);
6355 E1000_WRITE_REG(&Adapter->shared, E1000_RDT(0), 0);
6369 e1000g_param_sync(struct e1000g *Adapter)
6371 Adapter->param_en_1000fdx = Adapter->param_adv_1000fdx;
6372 Adapter->param_en_1000hdx = Adapter->param_adv_1000hdx;
6373 Adapter->param_en_100fdx = Adapter->param_adv_100fdx;
6374 Adapter->param_en_100hdx = Adapter->param_adv_100hdx;
6375 Adapter->param_en_10fdx = Adapter->param_adv_10fdx;
6376 Adapter->param_en_10hdx = Adapter->param_adv_10hdx;
6451 e1000g_restore_promisc(struct e1000g *Adapter)
6453 if (Adapter->e1000g_promisc) {
6456 rctl = E1000_READ_REG(&Adapter->shared, E1000_RCTL);
6458 E1000_WRITE_REG(&Adapter->shared, E1000_RCTL, rctl);