Lines Matching refs:hmep
102 #define KIOIP KSTAT_INTR_PTR(hmep->hme_intrstats)
204 static void hmeuninit(struct hme *hmep);
285 hme_check_acc_handle(__FILE__, __LINE__, hmep, hmep->hme_mifregh)
287 hme_check_acc_handle(__FILE__, __LINE__, hmep, hmep->hme_etxregh)
289 hme_check_acc_handle(__FILE__, __LINE__, hmep, hmep->hme_erxregh)
291 hme_check_acc_handle(__FILE__, __LINE__, hmep, hmep->hme_bmacregh)
293 hme_check_acc_handle(__FILE__, __LINE__, hmep, hmep->hme_globregh)
352 ddi_get32(hmep->hme_mifregh, (uint32_t *)&hmep->hme_mifregp->reg)
354 ddi_put32(hmep->hme_mifregh, (uint32_t *)&hmep->hme_mifregp->reg, value)
357 ddi_get32(hmep->hme_etxregh, (uint32_t *)&hmep->hme_etxregp->reg)
359 ddi_put32(hmep->hme_etxregh, (uint32_t *)&hmep->hme_etxregp->reg, value)
361 ddi_get32(hmep->hme_erxregh, (uint32_t *)&hmep->hme_erxregp->reg)
363 ddi_put32(hmep->hme_erxregh, (uint32_t *)&hmep->hme_erxregp->reg, value)
365 ddi_get32(hmep->hme_bmacregh, (uint32_t *)&hmep->hme_bmacregp->reg)
367 ddi_put32(hmep->hme_bmacregh, \
368 (uint32_t *)&hmep->hme_bmacregp->reg, value)
370 ddi_get32(hmep->hme_globregh, (uint32_t *)&hmep->hme_globregp->reg)
372 ddi_put32(hmep->hme_globregh, \
373 (uint32_t *)&hmep->hme_globregp->reg, value)
375 ddi_put32(hmep->hme_tmd_acch, &hmep->hme_tmdp[ptr].tmd_addr, paddr); \
376 ddi_put32(hmep->hme_tmd_acch, &hmep->hme_tmdp[ptr].tmd_flags, \
379 ddi_get32(hmep->hme_tmd_acch, &hmep->hme_tmdp[ptr].tmd_flags)
381 ddi_put32(hmep->hme_rmd_acch, &hmep->hme_rmdp[ptr].rmd_addr, paddr); \
382 ddi_put32(hmep->hme_rmd_acch, &hmep->hme_rmdp[ptr].rmd_flags, \
385 ddi_get32(hmep->hme_rmd_acch, &hmep->hme_rmdp[ptr].rmd_flags)
388 ddi_get8((hmep->hme_romh), (offset))
429 send_bit(struct hme *hmep, uint16_t x) in send_bit() argument
441 get_bit_std(uint8_t phyad, struct hme *hmep) in get_bit_std() argument
455 #define SEND_BIT(x) send_bit(hmep, x)
456 #define GET_BIT_STD(phyad, x) x = get_bit_std(phyad, hmep)
460 hme_bb_mii_write(struct hme *hmep, uint8_t phyad, uint8_t regad, uint16_t data) in hme_bb_mii_write() argument
465 (void) hme_bb_force_idle(hmep); in hme_bb_mii_write()
489 hme_bb_mii_read(struct hme *hmep, uint8_t phyad, uint8_t regad) in hme_bb_mii_read() argument
496 (void) hme_bb_force_idle(hmep); in hme_bb_mii_read()
526 hme_bb_force_idle(struct hme *hmep) in hme_bb_force_idle() argument
544 struct hme *hmep = arg; in hme_mii_read() local
565 if (!hmep->hme_frame_enable) { in hme_mii_read()
566 frame = (hme_bb_mii_read(hmep, phyad, regad)); in hme_mii_read()
588 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, MII_MSG, in hme_mii_read()
598 struct hme *hmep = arg; in hme_mii_write() local
619 if (!hmep->hme_frame_enable) { in hme_mii_write()
620 hme_bb_mii_write(hmep, phyad, regad, data); in hme_mii_write()
638 HME_FAULT_MSG1(hmep, SEVERITY_MID, MII_MSG, in hme_mii_write()
646 struct hme *hmep = arg; in hme_mii_notify() local
649 (void) hmeinit(hmep); in hme_mii_notify()
651 mac_link_update(hmep->hme_mh, link); in hme_mii_notify()
689 (void) ddi_dma_sync(hmep->hme_rmd_dmah, \
695 (void) ddi_dma_sync(hmep->hme_tmd_dmah, \
712 #define BUMP_InNUcast(hmep, pkt) \ argument
715 hmep->hme_brdcstrcv++; \
717 hmep->hme_multircv++; \
720 #define BUMP_OutNUcast(hmep, pkt) \ argument
723 hmep->hme_brdcstxmt++; \
725 hmep->hme_multixmt++; \
777 struct hme *hmep; in hme_get_oldvpd_props() local
783 hmep = ddi_get_driver_private(dip); in hme_get_oldvpd_props()
787 if ((GET_ROM8(&hmep->hme_romp[vpd_start]) & 0xff) != 0x90) { in hme_get_oldvpd_props()
797 kw_namestr[0] = GET_ROM8(&hmep->hme_romp[kw_ptr]); in hme_get_oldvpd_props()
798 kw_namestr[1] = GET_ROM8(&hmep->hme_romp[kw_ptr+1]); in hme_get_oldvpd_props()
800 kw_len = (int)(GET_ROM8(&hmep->hme_romp[kw_ptr+2]) & 0xff); in hme_get_oldvpd_props()
802 kw_fieldstr[i] = GET_ROM8(&hmep->hme_romp[kw_ptr+i]); in hme_get_oldvpd_props()
825 struct hme *hmep; in hme_get_newvpd_props() local
831 hmep = ddi_get_driver_private(dip); in hme_get_newvpd_props()
835 vpd_start = (int)((GET_ROM8(&(hmep->hme_romp[vpd_base+1])) & 0xff) | in hme_get_newvpd_props()
836 ((GET_ROM8(&hmep->hme_romp[vpd_base+2]) & 0xff) << 8)) +3; in hme_get_newvpd_props()
839 if ((GET_ROM8(&hmep->hme_romp[vpd_start]) & 0xff) != 0x90) { in hme_get_newvpd_props()
842 vpd_len = (int)((GET_ROM8(&hmep->hme_romp[vpd_start in hme_get_newvpd_props()
843 + 1]) & 0xff) | (GET_ROM8(&hmep->hme_romp[vpd_start in hme_get_newvpd_props()
850 kw_namestr[0] = GET_ROM8(&hmep->hme_romp[kw_ptr]); in hme_get_newvpd_props()
851 kw_namestr[1] = GET_ROM8(&hmep->hme_romp[kw_ptr+1]); in hme_get_newvpd_props()
854 (int)(GET_ROM8(&hmep->hme_romp[kw_ptr+2]) & 0xff); in hme_get_newvpd_props()
857 GET_ROM8(&hmep->hme_romp[kw_ptr+i]); in hme_get_newvpd_props()
877 struct hme *hmep; in hme_get_vpd_props() local
882 hmep = ddi_get_driver_private(dip); in hme_get_vpd_props()
884 v0 = (int)(GET_ROM8(&(hmep->hme_romp[0]))); in hme_get_vpd_props()
885 v1 = (int)(GET_ROM8(&(hmep->hme_romp[1]))); in hme_get_vpd_props()
896 if (((GET_ROM8(&(hmep->hme_romp[i])) & 0xff) == 'P') && in hme_get_vpd_props()
897 ((GET_ROM8(&(hmep->hme_romp[i+1])) & 0xff) == 'C') && in hme_get_vpd_props()
898 ((GET_ROM8(&(hmep->hme_romp[i+2])) & 0xff) == 'I') && in hme_get_vpd_props()
899 ((GET_ROM8(&(hmep->hme_romp[i+3])) & 0xff) == 'R')) { in hme_get_vpd_props()
901 (int)((GET_ROM8(&(hmep->hme_romp[i+8])) & 0xff) | in hme_get_vpd_props()
902 (GET_ROM8(&(hmep->hme_romp[i+9])) & 0xff) << 8); in hme_get_vpd_props()
913 v0 = (int)(GET_ROM8(&(hmep->hme_romp[vpd_base]))); in hme_get_vpd_props()
920 if ((GET_ROM8(&hmep->hme_romp[vpd_base + 12]) != 0x79) && in hme_get_vpd_props()
921 GET_ROM8(&hmep->hme_romp[vpd_base + 4 * 12]) == 0x79) { in hme_get_vpd_props()
922 vpd_base += hmep->hme_devno * 12; in hme_get_vpd_props()
940 struct hme *hmep; member
954 struct hme *hmep = rom->hmep; in hme_mapebusrom() local
989 (void) ddi_regs_map_setup(dip, 1, &rom->romp, 0, 0, &hmep->hme_dev_attr, in hme_mapebusrom()
1004 struct hme *hmep; in hmeget_promebus() local
1006 hmep = ddi_get_driver_private(dip); in hmeget_promebus()
1024 rom.hmep = hmep; in hmeget_promebus()
1027 hmep->hme_devno = rom.dev; in hmeget_promebus()
1042 hmep->hme_romh = rom.acch; in hmeget_promebus()
1043 hmep->hme_romp = (unsigned char *)rom.romp; in hmeget_promebus()
1052 struct hme *hmep; in hmeget_promprops() local
1076 hmep = ddi_get_driver_private(dip); in hmeget_promprops()
1082 if (ddi_regs_map_setup(hmep->dip, 0, (caddr_t *)&cfg_ptr, in hmeget_promprops()
1083 0, 0, &hmep->hme_dev_attr, &cfg_handle)) { in hmeget_promprops()
1101 if ((ddi_regs_map_setup(dip, 2, (caddr_t *)&(hmep->hme_romp), 0, 0, in hmeget_promprops()
1102 &hmep->hme_dev_attr, &hmep->hme_romh) != DDI_SUCCESS) && in hmeget_promprops()
1112 if (hmep->hme_romp) in hmeget_promprops()
1113 ddi_regs_map_free(&hmep->hme_romh); in hmeget_promprops()
1121 hmeget_hm_rev_property(struct hme *hmep) in hmeget_hm_rev_property() argument
1126 hm_rev = hmep->asic_rev; in hmeget_hm_rev_property()
1130 HME_FAULT_MSG2(hmep, SEVERITY_NONE, DISPLAY_MSG, in hmeget_hm_rev_property()
1132 hmep->hme_frame_enable = 1; in hmeget_hm_rev_property()
1136 HME_FAULT_MSG2(hmep, SEVERITY_NONE, DISPLAY_MSG, in hmeget_hm_rev_property()
1141 HME_FAULT_MSG2(hmep, SEVERITY_NONE, DISPLAY_MSG, in hmeget_hm_rev_property()
1146 HME_FAULT_MSG3(hmep, SEVERITY_NONE, DISPLAY_MSG, in hmeget_hm_rev_property()
1149 hmep->hme_frame_enable = 1; in hmeget_hm_rev_property()
1150 hmep->hme_lance_mode_enable = 1; in hmeget_hm_rev_property()
1151 hmep->hme_rxcv_enable = 1; in hmeget_hm_rev_property()
1164 struct hme *hmep; in hmeattach() local
1185 if ((hmep = ddi_get_driver_private(dip)) == NULL) in hmeattach()
1188 hmep->hme_flags &= ~HMESUSPENDED; in hmeattach()
1190 mii_resume(hmep->hme_mii); in hmeattach()
1192 if (hmep->hme_started) in hmeattach()
1193 (void) hmeinit(hmep); in hmeattach()
1203 hmep = kmem_zalloc(sizeof (*hmep), KM_SLEEP); in hmeattach()
1208 hmep->dip = dip; in hmeattach()
1209 hmep->instance = ddi_get_instance(dip); in hmeattach()
1210 hmep->pagesize = ddi_ptob(dip, (ulong_t)1); /* IOMMU PSize */ in hmeattach()
1216 ddi_set_driver_private(dip, hmep); in hmeattach()
1222 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, CONFIG_MSG, in hmeattach()
1237 HME_FAULT_MSG2(hmep, SEVERITY_HIGH, INIT_MSG, in hmeattach()
1244 hmep->hme_cheerio_mode = 0; in hmeattach()
1248 hmep->hme_cheerio_mode = 1; in hmeattach()
1251 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeattach()
1257 hmep->hme_dev_attr.devacc_attr_version = DDI_DEVICE_ATTR_V0; in hmeattach()
1259 if (hmep->hme_cheerio_mode) in hmeattach()
1260 hmep->hme_dev_attr.devacc_attr_endian_flags = in hmeattach()
1263 hmep->hme_dev_attr.devacc_attr_endian_flags = in hmeattach()
1266 hmep->hme_dev_attr.devacc_attr_dataorder = DDI_STRICTORDER_ACC; in hmeattach()
1268 if (hmep->hme_cheerio_mode) { in hmeattach()
1277 if (pci_config_setup(dip, &hmep->pci_config_handle) != in hmeattach()
1279 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, CONFIG_MSG, in hmeattach()
1285 (caddr_t *)&(hmep->hme_globregp), 0, 0, in hmeattach()
1286 &hmep->hme_dev_attr, &hmep->hme_globregh)) { in hmeattach()
1287 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, CONFIG_MSG, in hmeattach()
1291 hmep->hme_etxregh = hmep->hme_erxregh = hmep->hme_bmacregh = in hmeattach()
1292 hmep->hme_mifregh = hmep->hme_globregh; in hmeattach()
1294 hmep->hme_etxregp = in hmeattach()
1295 (void *)(((caddr_t)hmep->hme_globregp) + 0x2000); in hmeattach()
1296 hmep->hme_erxregp = in hmeattach()
1297 (void *)(((caddr_t)hmep->hme_globregp) + 0x4000); in hmeattach()
1298 hmep->hme_bmacregp = in hmeattach()
1299 (void *)(((caddr_t)hmep->hme_globregp) + 0x6000); in hmeattach()
1300 hmep->hme_mifregp = in hmeattach()
1301 (void *)(((caddr_t)hmep->hme_globregp) + 0x7000); in hmeattach()
1309 oldLT = pci_config_get8(hmep->pci_config_handle, in hmeattach()
1336 pci_config_put8(hmep->pci_config_handle, in hmeattach()
1340 (caddr_t *)&(hmep->hme_globregp), 0, 0, in hmeattach()
1341 &hmep->hme_dev_attr, &hmep->hme_globregh)) { in hmeattach()
1342 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, CONFIG_MSG, in hmeattach()
1347 (caddr_t *)&(hmep->hme_etxregp), 0, 0, in hmeattach()
1348 &hmep->hme_dev_attr, &hmep->hme_etxregh)) { in hmeattach()
1349 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, CONFIG_MSG, in hmeattach()
1354 (caddr_t *)&(hmep->hme_erxregp), 0, 0, in hmeattach()
1355 &hmep->hme_dev_attr, &hmep->hme_erxregh)) { in hmeattach()
1356 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, CONFIG_MSG, in hmeattach()
1361 (caddr_t *)&(hmep->hme_bmacregp), 0, 0, in hmeattach()
1362 &hmep->hme_dev_attr, &hmep->hme_bmacregh)) { in hmeattach()
1363 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, CONFIG_MSG, in hmeattach()
1369 (caddr_t *)&(hmep->hme_mifregp), 0, 0, in hmeattach()
1370 &hmep->hme_dev_attr, &hmep->hme_mifregh)) { in hmeattach()
1371 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, CONFIG_MSG, in hmeattach()
1381 hmep->hme_frame_enable = 0; in hmeattach()
1382 hmep->hme_lance_mode_enable = 0; in hmeattach()
1383 hmep->hme_rxcv_enable = 0; in hmeattach()
1387 if (ddi_getlongprop_buf(DDI_DEV_T_ANY, hmep->dip, 0, "hm-rev", in hmeattach()
1390 hmep->asic_rev = hm_rev; in hmeattach()
1391 hmeget_hm_rev_property(hmep); in hmeattach()
1398 if (ddi_regs_map_setup(hmep->dip, 0, (caddr_t *)&cfg_ptr, in hmeattach()
1399 0, 0, &hmep->hme_dev_attr, &cfg_handle)) { in hmeattach()
1409 hmep->asic_rev = hm_rev; in hmeattach()
1413 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, AUTOCONFIG_MSG, in hmeattach()
1418 hmeget_hm_rev_property(hmep); in hmeattach()
1422 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, AUTOCONFIG_MSG, in hmeattach()
1428 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, NFATAL_ERR_MSG, in hmeattach()
1436 if (ddi_get_iblock_cookie(dip, 0, &hmep->hme_cookie) != DDI_SUCCESS) in hmeattach()
1442 mutex_init(&hmep->hme_xmitlock, NULL, MUTEX_DRIVER, hmep->hme_cookie); in hmeattach()
1443 mutex_init(&hmep->hme_intrlock, NULL, MUTEX_DRIVER, hmep->hme_cookie); in hmeattach()
1448 (void) hmestop(hmep); in hmeattach()
1454 (ddi_idevice_cookie_t *)NULL, hmeintr, (caddr_t)hmep)) { in hmeattach()
1455 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, CONFIG_MSG, in hmeattach()
1463 hme_setup_mac_address(hmep, dip); in hmeattach()
1465 if (!hmeinit_xfer_params(hmep)) in hmeattach()
1468 if (hmeburstsizes(hmep) == DDI_FAILURE) { in hmeattach()
1469 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, burst_size_msg); in hmeattach()
1473 if (hmeallocthings(hmep) != DDI_SUCCESS) { in hmeattach()
1474 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, CONFIG_MSG, in hmeattach()
1479 if (hmeallocbufs(hmep) != DDI_SUCCESS) { in hmeattach()
1480 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, CONFIG_MSG, in hmeattach()
1485 hmestatinit(hmep); in hmeattach()
1490 hmep->hme_mii = mii_alloc(hmep, dip, &hme_mii_ops); in hmeattach()
1491 if (hmep->hme_mii == NULL) { in hmeattach()
1492 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, CONFIG_MSG, in hmeattach()
1497 mii_probe(hmep->hme_mii); in hmeattach()
1500 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, CONFIG_MSG, in hmeattach()
1505 macp->m_driver = hmep; in hmeattach()
1507 macp->m_src_addr = hmep->hme_ouraddr.ether_addr_octet; in hmeattach()
1513 if (mac_register(macp, &hmep->hme_mh) != 0) { in hmeattach()
1528 if (hmep->hme_cookie) in hmeattach()
1531 if (hmep->hme_mii) in hmeattach()
1532 mii_free(hmep->hme_mii); in hmeattach()
1535 mutex_destroy(&hmep->hme_xmitlock); in hmeattach()
1536 mutex_destroy(&hmep->hme_intrlock); in hmeattach()
1539 if (hmep->hme_globregh) in hmeattach()
1540 ddi_regs_map_free(&hmep->hme_globregh); in hmeattach()
1541 if (hmep->hme_cheerio_mode == 0) { in hmeattach()
1542 if (hmep->hme_etxregh) in hmeattach()
1543 ddi_regs_map_free(&hmep->hme_etxregh); in hmeattach()
1544 if (hmep->hme_erxregh) in hmeattach()
1545 ddi_regs_map_free(&hmep->hme_erxregh); in hmeattach()
1546 if (hmep->hme_bmacregh) in hmeattach()
1547 ddi_regs_map_free(&hmep->hme_bmacregh); in hmeattach()
1548 if (hmep->hme_mifregh) in hmeattach()
1549 ddi_regs_map_free(&hmep->hme_mifregh); in hmeattach()
1551 if (hmep->pci_config_handle) in hmeattach()
1552 (void) pci_config_teardown(&hmep->pci_config_handle); in hmeattach()
1553 hmep->hme_etxregh = hmep->hme_erxregh = hmep->hme_bmacregh = in hmeattach()
1554 hmep->hme_mifregh = hmep->hme_globregh = NULL; in hmeattach()
1558 hmefreethings(hmep); in hmeattach()
1559 hmefreebufs(hmep); in hmeattach()
1561 if (hmep) { in hmeattach()
1562 kmem_free((caddr_t)hmep, sizeof (*hmep)); in hmeattach()
1572 struct hme *hmep; in hmedetach() local
1574 if ((hmep = ddi_get_driver_private(dip)) == NULL) in hmedetach()
1582 mii_suspend(hmep->hme_mii); in hmedetach()
1583 hmep->hme_flags |= HMESUSPENDED; in hmedetach()
1584 hmeuninit(hmep); in hmedetach()
1592 if (mac_unregister(hmep->hme_mh) != 0) { in hmedetach()
1601 if (!(hmep->hme_flags & HMESUSPENDED)) { in hmedetach()
1602 (void) hmestop(hmep); in hmedetach()
1605 if (hmep->hme_mii) in hmedetach()
1606 mii_free(hmep->hme_mii); in hmedetach()
1616 if (hmep->hme_ksp != NULL) in hmedetach()
1617 kstat_delete(hmep->hme_ksp); in hmedetach()
1618 if (hmep->hme_intrstats != NULL) in hmedetach()
1619 kstat_delete(hmep->hme_intrstats); in hmedetach()
1621 hmep->hme_ksp = NULL; in hmedetach()
1622 hmep->hme_intrstats = NULL; in hmedetach()
1632 if (hmep->hme_globregh) in hmedetach()
1633 ddi_regs_map_free(&hmep->hme_globregh); in hmedetach()
1634 if (hmep->hme_cheerio_mode == 0) { in hmedetach()
1635 if (hmep->hme_etxregh) in hmedetach()
1636 ddi_regs_map_free(&hmep->hme_etxregh); in hmedetach()
1637 if (hmep->hme_erxregh) in hmedetach()
1638 ddi_regs_map_free(&hmep->hme_erxregh); in hmedetach()
1639 if (hmep->hme_bmacregh) in hmedetach()
1640 ddi_regs_map_free(&hmep->hme_bmacregh); in hmedetach()
1641 if (hmep->hme_mifregh) in hmedetach()
1642 ddi_regs_map_free(&hmep->hme_mifregh); in hmedetach()
1644 if (hmep->pci_config_handle) in hmedetach()
1645 (void) pci_config_teardown(&hmep->pci_config_handle); in hmedetach()
1646 hmep->hme_etxregh = hmep->hme_erxregh = hmep->hme_bmacregh = in hmedetach()
1647 hmep->hme_mifregh = hmep->hme_globregh = NULL; in hmedetach()
1650 mutex_destroy(&hmep->hme_xmitlock); in hmedetach()
1651 mutex_destroy(&hmep->hme_intrlock); in hmedetach()
1653 hmefreethings(hmep); in hmedetach()
1654 hmefreebufs(hmep); in hmedetach()
1657 kmem_free(hmep, sizeof (struct hme)); in hmedetach()
1665 struct hme *hmep; in hmequiesce() local
1667 if ((hmep = ddi_get_driver_private(dip)) == NULL) in hmequiesce()
1670 (void) hmestop(hmep); in hmequiesce()
1675 hmeinit_xfer_params(struct hme *hmep) in hmeinit_xfer_params() argument
1682 dip = hmep->dip; in hmeinit_xfer_params()
1689 hmep->hme_ipg1 = hme_ipg1 & HME_MASK_8BIT; in hmeinit_xfer_params()
1690 hmep->hme_ipg2 = hme_ipg2 & HME_MASK_8BIT; in hmeinit_xfer_params()
1691 hmep->hme_ipg0 = hme_ipg0 & HME_MASK_5BIT; in hmeinit_xfer_params()
1698 hmep->hme_ipg1 = hme_ipg1_conf & HME_MASK_8BIT; in hmeinit_xfer_params()
1703 hmep->hme_ipg2 = hme_ipg2_conf & HME_MASK_8BIT; in hmeinit_xfer_params()
1708 hmep->hme_ipg0 = hme_ipg0_conf & HME_MASK_5BIT; in hmeinit_xfer_params()
1713 hmep->hme_lance_mode = hme_lance_mode_conf & HME_MASK_1BIT; in hmeinit_xfer_params()
1723 hmestop(struct hme *hmep) in hmestop() argument
1755 struct hme *hmep; in hmestat_kstat_update() local
1758 hmep = (struct hme *)ksp->ks_private; in hmestat_kstat_update()
1770 mutex_enter(&hmep->hme_xmitlock); in hmestat_kstat_update()
1771 if (hmep->hme_flags & HMERUNNING) { in hmestat_kstat_update()
1772 hmereclaim(hmep); in hmestat_kstat_update()
1773 hmesavecntrs(hmep); in hmestat_kstat_update()
1775 mutex_exit(&hmep->hme_xmitlock); in hmestat_kstat_update()
1777 hkp->hk_cvc.value.ul = hmep->hme_cvc; in hmestat_kstat_update()
1778 hkp->hk_lenerr.value.ul = hmep->hme_lenerr; in hmestat_kstat_update()
1779 hkp->hk_buff.value.ul = hmep->hme_buff; in hmestat_kstat_update()
1780 hkp->hk_missed.value.ul = hmep->hme_missed; in hmestat_kstat_update()
1781 hkp->hk_allocbfail.value.ul = hmep->hme_allocbfail; in hmestat_kstat_update()
1782 hkp->hk_babl.value.ul = hmep->hme_babl; in hmestat_kstat_update()
1783 hkp->hk_tmder.value.ul = hmep->hme_tmder; in hmestat_kstat_update()
1784 hkp->hk_txlaterr.value.ul = hmep->hme_txlaterr; in hmestat_kstat_update()
1785 hkp->hk_rxlaterr.value.ul = hmep->hme_rxlaterr; in hmestat_kstat_update()
1786 hkp->hk_slvparerr.value.ul = hmep->hme_slvparerr; in hmestat_kstat_update()
1787 hkp->hk_txparerr.value.ul = hmep->hme_txparerr; in hmestat_kstat_update()
1788 hkp->hk_rxparerr.value.ul = hmep->hme_rxparerr; in hmestat_kstat_update()
1789 hkp->hk_slverrack.value.ul = hmep->hme_slverrack; in hmestat_kstat_update()
1790 hkp->hk_txerrack.value.ul = hmep->hme_txerrack; in hmestat_kstat_update()
1791 hkp->hk_rxerrack.value.ul = hmep->hme_rxerrack; in hmestat_kstat_update()
1792 hkp->hk_txtagerr.value.ul = hmep->hme_txtagerr; in hmestat_kstat_update()
1793 hkp->hk_rxtagerr.value.ul = hmep->hme_rxtagerr; in hmestat_kstat_update()
1794 hkp->hk_eoperr.value.ul = hmep->hme_eoperr; in hmestat_kstat_update()
1795 hkp->hk_notmds.value.ul = hmep->hme_notmds; in hmestat_kstat_update()
1796 hkp->hk_notbufs.value.ul = hmep->hme_notbufs; in hmestat_kstat_update()
1797 hkp->hk_norbufs.value.ul = hmep->hme_norbufs; in hmestat_kstat_update()
1802 hkp->hk_inits.value.ul = hmep->inits; in hmestat_kstat_update()
1803 hkp->hk_phyfail.value.ul = hmep->phyfail; in hmestat_kstat_update()
1808 hkp->hk_asic_rev.value.ul = hmep->asic_rev; in hmestat_kstat_update()
1814 hmestatinit(struct hme *hmep) in hmestatinit() argument
1822 instance = hmep->instance; in hmestatinit()
1823 driver = ddi_driver_name(hmep->dip); in hmestatinit()
1828 HME_FAULT_MSG1(hmep, SEVERITY_UNKNOWN, INIT_MSG, in hmestatinit()
1834 hmep->hme_intrstats = kstat_create(driver, instance, buf, "controller", in hmestatinit()
1836 if (hmep->hme_intrstats) in hmestatinit()
1837 kstat_install(hmep->hme_intrstats); in hmestatinit()
1839 hmep->hme_ksp = ksp; in hmestatinit()
1901 ksp->ks_private = (void *) hmep; in hmestatinit()
1909 struct hme *hmep = arg; in hme_m_getprop() local
1913 rv = mii_m_getprop(hmep->hme_mii, name, num, sz, val); in hme_m_getprop()
1925 value = hmep->hme_ipg0; in hme_m_getprop()
1927 value = hmep->hme_ipg1; in hme_m_getprop()
1929 value = hmep->hme_ipg2; in hme_m_getprop()
1931 value = hmep->hme_lance_mode; in hme_m_getprop()
1943 struct hme *hmep = arg; in hme_m_propinfo() local
1945 mii_m_propinfo(hmep->hme_mii, name, num, mph); in hme_m_propinfo()
1975 struct hme *hmep = arg; in hme_m_setprop() local
1980 rv = mii_m_setprop(hmep->hme_mii, name, num, sz, val); in hme_m_setprop()
1996 hmep->hme_ipg1 = lval & 0xff; in hme_m_setprop()
2004 hmep->hme_ipg2 = lval & 0xff; in hme_m_setprop()
2012 hmep->hme_ipg0 = lval & 0xff; in hme_m_setprop()
2019 hmep->hme_lance_mode = lval & 0xff; in hme_m_setprop()
2030 (void) hmeinit(hmep); in hme_m_setprop()
2052 struct hme *hmep = arg; in hme_m_promisc() local
2054 hmep->hme_promisc = on; in hme_m_promisc()
2055 (void) hmeinit(hmep); in hme_m_promisc()
2062 struct hme *hmep = arg; in hme_m_unicst() local
2069 mutex_enter(&hmep->hme_intrlock); in hme_m_unicst()
2070 bcopy(macaddr, &hmep->hme_ouraddr, ETHERADDRL); in hme_m_unicst()
2071 mutex_exit(&hmep->hme_intrlock); in hme_m_unicst()
2072 (void) hmeinit(hmep); in hme_m_unicst()
2079 struct hme *hmep = arg; in hme_m_multicst() local
2089 mutex_enter(&hmep->hme_intrlock); in hme_m_multicst()
2091 hmep->hme_ladrf_refcnt[ladrf_bit]++; in hme_m_multicst()
2092 if (hmep->hme_ladrf_refcnt[ladrf_bit] == 1) { in hme_m_multicst()
2093 hmep->hme_ladrf[ladrf_bit >> 4] |= in hme_m_multicst()
2095 hmep->hme_multi++; in hme_m_multicst()
2099 hmep->hme_ladrf_refcnt[ladrf_bit]--; in hme_m_multicst()
2100 if (hmep->hme_ladrf_refcnt[ladrf_bit] == 0) { in hme_m_multicst()
2101 hmep->hme_ladrf[ladrf_bit >> 4] &= in hme_m_multicst()
2106 mutex_exit(&hmep->hme_intrlock); in hme_m_multicst()
2109 (void) hmeinit(hmep); in hme_m_multicst()
2118 struct hme *hmep = arg; in hme_m_start() local
2120 if (hmeinit(hmep) != 0) { in hme_m_start()
2124 hmep->hme_started = B_TRUE; in hme_m_start()
2125 mii_start(hmep->hme_mii); in hme_m_start()
2133 struct hme *hmep = arg; in hme_m_stop() local
2135 mii_stop(hmep->hme_mii); in hme_m_stop()
2136 hmep->hme_started = B_FALSE; in hme_m_stop()
2137 hmeuninit(hmep); in hme_m_stop()
2143 struct hme *hmep = arg; in hme_m_stat() local
2145 mutex_enter(&hmep->hme_xmitlock); in hme_m_stat()
2146 if (hmep->hme_flags & HMERUNNING) { in hme_m_stat()
2147 hmereclaim(hmep); in hme_m_stat()
2148 hmesavecntrs(hmep); in hme_m_stat()
2150 mutex_exit(&hmep->hme_xmitlock); in hme_m_stat()
2153 if (mii_m_getstat(hmep->hme_mii, stat, val) == 0) { in hme_m_stat()
2158 *val = hmep->hme_ipackets; in hme_m_stat()
2161 *val = hmep->hme_rbytes; in hme_m_stat()
2164 *val = hmep->hme_ierrors; in hme_m_stat()
2167 *val = hmep->hme_opackets; in hme_m_stat()
2170 *val = hmep->hme_obytes; in hme_m_stat()
2173 *val = hmep->hme_oerrors; in hme_m_stat()
2176 *val = hmep->hme_multircv; in hme_m_stat()
2179 *val = hmep->hme_multixmt; in hme_m_stat()
2182 *val = hmep->hme_brdcstrcv; in hme_m_stat()
2185 *val = hmep->hme_brdcstxmt; in hme_m_stat()
2188 *val = hmep->hme_uflo; in hme_m_stat()
2191 *val = hmep->hme_oflo; in hme_m_stat()
2194 *val = hmep->hme_coll; in hme_m_stat()
2197 *val = hmep->hme_norcvbuf; in hme_m_stat()
2200 *val = hmep->hme_noxmtbuf; in hme_m_stat()
2203 *val = hmep->hme_duplex; in hme_m_stat()
2206 *val = hmep->hme_align_errors; in hme_m_stat()
2209 *val = hmep->hme_fcs_errors; in hme_m_stat()
2212 *val = hmep->hme_excol; in hme_m_stat()
2215 *val = hmep->hme_defer_xmts; in hme_m_stat()
2218 *val = hmep->hme_sqe_errors; in hme_m_stat()
2221 *val = hmep->hme_fstcol; in hme_m_stat()
2224 *val = hmep->hme_tlcol; in hme_m_stat()
2227 *val = hmep->hme_toolong_errors; in hme_m_stat()
2230 *val = hmep->hme_runt; in hme_m_stat()
2233 *val = hmep->hme_carrier_errors; in hme_m_stat()
2244 struct hme *hmep = arg; in hme_m_tx() local
2250 if (!hmestart(hmep, mp)) { in hme_m_tx()
2287 hmestart(struct hme *hmep, mblk_t *mp) in hmestart() argument
2314 mutex_enter(&hmep->hme_xmitlock); in hmestart()
2316 if (hmep->hme_flags & HMESUSPENDED) { in hmestart()
2317 hmep->hme_carrier_errors++; in hmestart()
2318 hmep->hme_oerrors++; in hmestart()
2322 if (hmep->hme_txindex != hmep->hme_txreclaim) { in hmestart()
2323 hmereclaim(hmep); in hmestart()
2325 if ((hmep->hme_txindex - HME_TMDMAX) == hmep->hme_txreclaim) in hmestart()
2327 txptr = hmep->hme_txindex % HME_TMDMAX; in hmestart()
2328 tbuf = &hmep->hme_tbuf[txptr]; in hmestart()
2356 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, DDI_MSG, in hmestart()
2363 BUMP_OutNUcast(hmep, tbuf->kaddr); in hmestart()
2369 hmep->hme_txindex++; in hmestart()
2374 mutex_exit(&hmep->hme_xmitlock); in hmestart()
2376 hmep->hme_starts++; in hmestart()
2380 mutex_exit(&hmep->hme_xmitlock); in hmestart()
2385 hmep->hme_notmds++; in hmestart()
2386 hmep->hme_wantw = B_TRUE; in hmestart()
2387 hmereclaim(hmep); in hmestart()
2390 mutex_exit(&hmep->hme_xmitlock); in hmestart()
2433 hmeinit(struct hme *hmep) in hmeinit() argument
2444 mutex_enter(&hmep->hme_intrlock); in hmeinit()
2452 if (hmep->hme_flags & HMESUSPENDED) { in hmeinit()
2453 mutex_exit(&hmep->hme_intrlock); in hmeinit()
2471 mutex_enter(&hmep->hme_xmitlock); in hmeinit()
2473 hmep->hme_flags = 0; in hmeinit()
2474 hmep->hme_wantw = B_FALSE; in hmeinit()
2476 if (hmep->inits) in hmeinit()
2477 hmesavecntrs(hmep); in hmeinit()
2482 (void) hmestop(hmep); in hmeinit()
2487 bzero(hmep->hme_rmdp, HME_RMDMAX * sizeof (struct hme_rmd)); in hmeinit()
2488 bzero(hmep->hme_tmdp, HME_TMDMAX * sizeof (struct hme_tmd)); in hmeinit()
2494 PUT_RMD(i, hmep->hme_rbuf[i].paddr); in hmeinit()
2500 (void) ddi_dma_sync(hmep->hme_rmd_dmah, 0, 0, DDI_DMA_SYNC_FORDEV); in hmeinit()
2501 (void) ddi_dma_sync(hmep->hme_tmd_dmah, 0, 0, DDI_DMA_SYNC_FORDEV); in hmeinit()
2506 hmep->hme_rxindex = 0; in hmeinit()
2507 hmep->hme_txindex = hmep->hme_txreclaim = 0; in hmeinit()
2515 if (!hmep->hme_frame_enable) in hmeinit()
2528 switch ((phyad = mii_get_addr(hmep->hme_mii))) { in hmeinit()
2530 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, XCVR_MSG, no_xcvr_msg); in hmeinit()
2542 hmep->inits++; in hmeinit()
2577 PUT_MACREG(ipg1, hmep->hme_ipg1); in hmeinit()
2578 PUT_MACREG(ipg2, hmep->hme_ipg2); in hmeinit()
2581 ((hmep->hme_ouraddr.ether_addr_octet[0] << 8) & 0x3) | in hmeinit()
2582 hmep->hme_ouraddr.ether_addr_octet[1]); in hmeinit()
2589 PUT_MACREG(madd2, (hmep->hme_ouraddr.ether_addr_octet[4] << 8) | in hmeinit()
2590 hmep->hme_ouraddr.ether_addr_octet[5]); in hmeinit()
2591 PUT_MACREG(madd1, (hmep->hme_ouraddr.ether_addr_octet[2] << 8) | in hmeinit()
2592 hmep->hme_ouraddr.ether_addr_octet[3]); in hmeinit()
2593 PUT_MACREG(madd0, (hmep->hme_ouraddr.ether_addr_octet[0] << 8) | in hmeinit()
2594 hmep->hme_ouraddr.ether_addr_octet[1]); in hmeinit()
2603 PUT_MACREG(hash0, hmep->hme_ladrf[0]); in hmeinit()
2604 PUT_MACREG(hash1, hmep->hme_ladrf[1]); in hmeinit()
2605 PUT_MACREG(hash2, hmep->hme_ladrf[2]); in hmeinit()
2606 PUT_MACREG(hash3, hmep->hme_ladrf[3]); in hmeinit()
2619 PUT_ETXREG(txring, hmep->hme_tmd_paddr); in hmeinit()
2620 PUT_ERXREG(rxring, hmep->hme_rmd_paddr); in hmeinit()
2630 temp = hmep->hme_rmd_paddr; in hmeinit()
2636 PUT_GLOBREG(config, (hmep->hme_config | in hmeinit()
2637 (hmep->hme_64bit_xfer << HMEG_CONFIG_64BIT_SHIFT))); in hmeinit()
2665 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeinit()
2691 HME_FAULT_MSG4(hmep, SEVERITY_UNKNOWN, ERX_MSG, in hmeinit()
2708 ((hmep->hme_promisc ? BMAC_RXCFG_PROMIS : 0) | in hmeinit()
2712 ((hmep->hme_promisc ? BMAC_RXCFG_PROMIS : 0) | in hmeinit()
2718 fdx = (mii_get_duplex(hmep->hme_mii) == LINK_DUPLEX_FULL); in hmeinit()
2727 if ((hmep->hme_lance_mode) && (hmep->hme_lance_mode_enable)) in hmeinit()
2728 i = ((hmep->hme_ipg0 & HME_MASK_5BIT) << BMAC_XIFC_IPG0_SHIFT) in hmeinit()
2738 hmep->hme_flags |= (HMERUNNING | HMEINITIALIZED); in hmeinit()
2743 mac_tx_update(hmep->hme_mh); in hmeinit()
2749 mutex_exit(&hmep->hme_xmitlock); in hmeinit()
2750 mutex_exit(&hmep->hme_intrlock); in hmeinit()
2752 ret = !(hmep->hme_flags & HMERUNNING); in hmeinit()
2754 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeinit()
2779 hmeburstsizes(struct hme *hmep) in hmeburstsizes() argument
2784 if (ddi_dma_alloc_handle(hmep->dip, &hme_dma_attr, in hmeburstsizes()
2789 hmep->hme_burstsizes = burstsizes = ddi_dma_burstsizes(handle); in hmeburstsizes()
2795 burstsizes = (hmep->hme_burstsizes >> 16); in hmeburstsizes()
2797 hmep->hme_64bit_xfer = hme_64bit_enable; /* user config value */ in hmeburstsizes()
2799 burstsizes = hmep->hme_burstsizes; in hmeburstsizes()
2801 if (hmep->hme_cheerio_mode) in hmeburstsizes()
2802 hmep->hme_64bit_xfer = 0; /* Disable for cheerio */ in hmeburstsizes()
2805 hmep->hme_config = HMEG_CONFIG_BURST64; in hmeburstsizes()
2807 hmep->hme_config = HMEG_CONFIG_BURST32; in hmeburstsizes()
2809 hmep->hme_config = HMEG_CONFIG_BURST16; in hmeburstsizes()
2815 hmeallocbuf(struct hme *hmep, hmebuf_t *buf, int dir) in hmeallocbuf() argument
2821 if (ddi_dma_alloc_handle(hmep->dip, &hme_dma_attr, in hmeallocbuf()
2823 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocbuf()
2831 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocbuf()
2839 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocbuf()
2847 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocbuf()
2855 hmeallocbufs(struct hme *hmep) in hmeallocbufs() argument
2857 hmep->hme_tbuf = kmem_zalloc(HME_TMDMAX * sizeof (hmebuf_t), KM_SLEEP); in hmeallocbufs()
2858 hmep->hme_rbuf = kmem_zalloc(HME_RMDMAX * sizeof (hmebuf_t), KM_SLEEP); in hmeallocbufs()
2862 if (hmeallocbuf(hmep, &hmep->hme_rbuf[i], DDI_DMA_READ) != in hmeallocbufs()
2870 if (hmeallocbuf(hmep, &hmep->hme_tbuf[i], DDI_DMA_WRITE) != in hmeallocbufs()
2879 hmefreebufs(struct hme *hmep) in hmefreebufs() argument
2883 if (hmep->hme_rbuf == NULL) in hmefreebufs()
2893 hmebuf_t *tbuf = &hmep->hme_tbuf[i]; in hmefreebufs()
2905 hmebuf_t *rbuf = &hmep->hme_rbuf[i]; in hmefreebufs()
2916 kmem_free(hmep->hme_rbuf, HME_RMDMAX * sizeof (hmebuf_t)); in hmefreebufs()
2917 kmem_free(hmep->hme_tbuf, HME_TMDMAX * sizeof (hmebuf_t)); in hmefreebufs()
2924 hmeuninit(struct hme *hmep) in hmeuninit() argument
2929 HMEDELAY((hmep->hme_txindex == hmep->hme_txreclaim), HMEDRAINTIME); in hmeuninit()
2931 mutex_enter(&hmep->hme_intrlock); in hmeuninit()
2932 mutex_enter(&hmep->hme_xmitlock); in hmeuninit()
2934 hmep->hme_flags &= ~HMERUNNING; in hmeuninit()
2936 (void) hmestop(hmep); in hmeuninit()
2938 mutex_exit(&hmep->hme_xmitlock); in hmeuninit()
2939 mutex_exit(&hmep->hme_intrlock); in hmeuninit()
2948 hmeallocthings(struct hme *hmep) in hmeallocthings() argument
2955 dev_info_t *dip = hmep->dip; in hmeallocthings()
2962 &hmep->hme_rmd_dmah); in hmeallocthings()
2964 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocthings()
2969 rval = ddi_dma_mem_alloc(hmep->hme_rmd_dmah, size, in hmeallocthings()
2970 &hmep->hme_dev_attr, DDI_DMA_CONSISTENT, DDI_DMA_DONTWAIT, NULL, in hmeallocthings()
2971 &hmep->hme_rmd_kaddr, &real_len, &hmep->hme_rmd_acch); in hmeallocthings()
2973 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocthings()
2977 hmep->hme_rmdp = (void *)(hmep->hme_rmd_kaddr); in hmeallocthings()
2978 rval = ddi_dma_addr_bind_handle(hmep->hme_rmd_dmah, NULL, in hmeallocthings()
2979 hmep->hme_rmd_kaddr, size, DDI_DMA_RDWR | DDI_DMA_CONSISTENT, in hmeallocthings()
2982 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocthings()
2986 hmep->hme_rmd_paddr = dmac.dmac_address; in hmeallocthings()
2988 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocthings()
2994 &hmep->hme_tmd_dmah); in hmeallocthings()
2996 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocthings()
3001 rval = ddi_dma_mem_alloc(hmep->hme_tmd_dmah, size, in hmeallocthings()
3002 &hmep->hme_dev_attr, DDI_DMA_CONSISTENT, DDI_DMA_DONTWAIT, NULL, in hmeallocthings()
3003 &hmep->hme_tmd_kaddr, &real_len, &hmep->hme_tmd_acch); in hmeallocthings()
3005 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocthings()
3009 hmep->hme_tmdp = (void *)(hmep->hme_tmd_kaddr); in hmeallocthings()
3010 rval = ddi_dma_addr_bind_handle(hmep->hme_tmd_dmah, NULL, in hmeallocthings()
3011 hmep->hme_tmd_kaddr, size, DDI_DMA_RDWR | DDI_DMA_CONSISTENT, in hmeallocthings()
3014 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocthings()
3018 hmep->hme_tmd_paddr = dmac.dmac_address; in hmeallocthings()
3020 HME_FAULT_MSG1(hmep, SEVERITY_HIGH, INIT_MSG, in hmeallocthings()
3029 hmefreethings(struct hme *hmep) in hmefreethings() argument
3031 if (hmep->hme_rmd_paddr) { in hmefreethings()
3032 (void) ddi_dma_unbind_handle(hmep->hme_rmd_dmah); in hmefreethings()
3033 hmep->hme_rmd_paddr = 0; in hmefreethings()
3035 if (hmep->hme_rmd_acch) in hmefreethings()
3036 ddi_dma_mem_free(&hmep->hme_rmd_acch); in hmefreethings()
3037 if (hmep->hme_rmd_dmah) in hmefreethings()
3038 ddi_dma_free_handle(&hmep->hme_rmd_dmah); in hmefreethings()
3040 if (hmep->hme_tmd_paddr) { in hmefreethings()
3041 (void) ddi_dma_unbind_handle(hmep->hme_tmd_dmah); in hmefreethings()
3042 hmep->hme_tmd_paddr = 0; in hmefreethings()
3044 if (hmep->hme_tmd_acch) in hmefreethings()
3045 ddi_dma_mem_free(&hmep->hme_tmd_acch); in hmefreethings()
3046 if (hmep->hme_tmd_dmah) in hmefreethings()
3047 ddi_dma_free_handle(&hmep->hme_tmd_dmah); in hmefreethings()
3056 struct hme *hmep = (void *)arg; in hmeintr() local
3067 mutex_enter(&hmep->hme_intrlock); in hmeintr()
3084 if (hmep->hme_flags & HMEINITIALIZED) { in hmeintr()
3085 hmep->hme_flags &= ~HMEINITIALIZED; in hmeintr()
3091 if (hmep->hme_intrstats) { in hmeintr()
3097 mutex_exit(&hmep->hme_intrlock); in hmeintr()
3103 if (!(hmep->hme_flags & HMERUNNING)) { in hmeintr()
3104 if (hmep->hme_intrstats) in hmeintr()
3106 mutex_exit(&hmep->hme_intrlock); in hmeintr()
3107 hmeuninit(hmep); in hmeintr()
3114 if (hmep->hme_intrstats) in hmeintr()
3116 hme_fatal_err(hmep, hmesbits); in hmeintr()
3118 mutex_exit(&hmep->hme_intrlock); in hmeintr()
3119 (void) hmeinit(hmep); in hmeintr()
3122 hme_nonfatal_err(hmep, hmesbits); in hmeintr()
3126 mutex_enter(&hmep->hme_xmitlock); in hmeintr()
3128 hmereclaim(hmep); in hmeintr()
3129 mutex_exit(&hmep->hme_xmitlock); in hmeintr()
3147 rxptr = hmep->hme_rxindex % HME_RMDMAX; in hmeintr()
3161 rbuf = &hmep->hme_rbuf[rxptr]; in hmeintr()
3162 mp = hmeread(hmep, rbuf, rflags); in hmeintr()
3178 hmep->hme_rxindex++; in hmeintr()
3182 if (hmep->hme_intrstats) in hmeintr()
3185 mutex_exit(&hmep->hme_intrlock); in hmeintr()
3188 mac_rx(hmep->hme_mh, NULL, head); in hmeintr()
3197 hmereclaim(struct hme *hmep) in hmereclaim() argument
3204 while (hmep->hme_txindex > hmep->hme_txreclaim) { in hmereclaim()
3209 reclaim = hmep->hme_txreclaim % HME_TMDMAX; in hmereclaim()
3224 hmep->hme_opackets++; in hmereclaim()
3230 hmep->hme_obytes += flags & HMETMD_BUFSIZE; in hmereclaim()
3233 hmep->hme_txreclaim++; in hmereclaim()
3240 if (hmep->hme_wantw) { in hmereclaim()
3244 hmep->hme_wantw = B_FALSE; in hmereclaim()
3245 mac_tx_update(hmep->hme_mh); in hmereclaim()
3252 if (hmep->hme_wantw) in hmereclaim()
3264 hme_fatal_err(struct hme *hmep, uint_t hmesbits) in hme_fatal_err() argument
3268 hmep->hme_slvparerr++; in hme_fatal_err()
3272 hmep->hme_slverrack++; in hme_fatal_err()
3276 hmep->hme_txtagerr++; in hme_fatal_err()
3277 hmep->hme_oerrors++; in hme_fatal_err()
3281 hmep->hme_txparerr++; in hme_fatal_err()
3282 hmep->hme_oerrors++; in hme_fatal_err()
3286 hmep->hme_txlaterr++; in hme_fatal_err()
3287 hmep->hme_oerrors++; in hme_fatal_err()
3291 hmep->hme_txerrack++; in hme_fatal_err()
3292 hmep->hme_oerrors++; in hme_fatal_err()
3296 hmep->hme_eoperr++; in hme_fatal_err()
3300 hmep->hme_rxtagerr++; in hme_fatal_err()
3301 hmep->hme_ierrors++; in hme_fatal_err()
3305 hmep->hme_rxparerr++; in hme_fatal_err()
3306 hmep->hme_ierrors++; in hme_fatal_err()
3310 hmep->hme_rxlaterr++; in hme_fatal_err()
3311 hmep->hme_ierrors++; in hme_fatal_err()
3315 hmep->hme_rxerrack++; in hme_fatal_err()
3316 hmep->hme_ierrors++; in hme_fatal_err()
3324 hme_nonfatal_err(struct hme *hmep, uint_t hmesbits) in hme_nonfatal_err() argument
3328 hmep->hme_missed++; in hme_nonfatal_err()
3329 hmep->hme_ierrors++; in hme_nonfatal_err()
3333 hmep->hme_defer_xmts++; in hme_nonfatal_err()
3337 hmep->hme_fstcol += 256; in hme_nonfatal_err()
3341 hmep->hme_tlcol += 256; in hme_nonfatal_err()
3342 hmep->hme_oerrors += 256; in hme_nonfatal_err()
3346 hmep->hme_excol += 256; in hme_nonfatal_err()
3347 hmep->hme_oerrors += 256; in hme_nonfatal_err()
3351 hmep->hme_coll += 256; in hme_nonfatal_err()
3355 hmep->hme_babl++; in hme_nonfatal_err()
3356 hmep->hme_oerrors++; in hme_nonfatal_err()
3364 hmep->hme_uflo++; in hme_nonfatal_err()
3365 hmep->hme_oerrors++; in hme_nonfatal_err()
3369 hmep->hme_sqe_errors++; in hme_nonfatal_err()
3373 if (hmep->hme_rxcv_enable) { in hme_nonfatal_err()
3374 hmep->hme_cvc += 256; in hme_nonfatal_err()
3379 hmep->hme_oflo++; in hme_nonfatal_err()
3380 hmep->hme_ierrors++; in hme_nonfatal_err()
3384 hmep->hme_lenerr += 256; in hme_nonfatal_err()
3385 hmep->hme_ierrors += 256; in hme_nonfatal_err()
3389 hmep->hme_align_errors += 256; in hme_nonfatal_err()
3390 hmep->hme_ierrors += 256; in hme_nonfatal_err()
3394 hmep->hme_fcs_errors += 256; in hme_nonfatal_err()
3395 hmep->hme_ierrors += 256; in hme_nonfatal_err()
3400 hmeread(struct hme *hmep, hmebuf_t *rbuf, uint32_t rflags) in hmeread() argument
3417 hmep->hme_runt++; in hmeread()
3420 hmep->hme_buff++; in hmeread()
3421 hmep->hme_toolong_errors++; in hmeread()
3423 hmep->hme_ierrors++; in hmeread()
3439 hmep->hme_allocbfail++; in hmeread()
3440 hmep->hme_norcvbuf++; in hmeread()
3447 hmep->hme_ipackets++; in hmeread()
3456 BUMP_InNUcast(hmep, bp->b_rptr); in hmeread()
3457 hmep->hme_rbytes += len; in hmeread()
3475 hme_fault_msg(struct hme *hmep, uint_t severity, msg_t type, char *fmt, ...) in hme_fault_msg() argument
3483 if (hmep == NULL) { in hme_fault_msg()
3487 cmn_err(CE_CONT, "?%s%d : %s\n", ddi_driver_name(hmep->dip), in hme_fault_msg()
3488 hmep->instance, msg_buffer); in hme_fault_msg()
3491 ddi_driver_name(hmep->dip), hmep->instance, in hme_fault_msg()
3494 cmn_err(CE_CONT, "%s%d : %s\n", ddi_driver_name(hmep->dip), in hme_fault_msg()
3495 hmep->instance, msg_buffer); in hme_fault_msg()
3505 hmesavecntrs(struct hme *hmep) in hmesavecntrs() argument
3515 hmep->hme_align_errors += aecnt; in hmesavecntrs()
3519 hmep->hme_lenerr += lecnt; in hmesavecntrs()
3527 if (!hmep->hme_rxcv_enable) { in hmesavecntrs()
3531 hmep->hme_cvc += rxcv; in hmesavecntrs()
3535 hmep->hme_tlcol += ltcnt; in hmesavecntrs()
3539 hmep->hme_excol += excnt; in hmesavecntrs()
3542 hmep->hme_fcs_errors += fecnt; in hmesavecntrs()
3543 hmep->hme_ierrors += (fecnt + aecnt + lecnt); in hmesavecntrs()
3544 hmep->hme_oerrors += (ltcnt + excnt); in hmesavecntrs()
3545 hmep->hme_coll += (GET_MACREG(nccnt) + ltcnt); in hmesavecntrs()
3566 hme_setup_mac_address(struct hme *hmep, dev_info_t *dip) in hme_setup_mac_address() argument
3571 hmep->hme_addrflags = 0; in hme_setup_mac_address()
3582 hmep->hme_addrflags = HME_FACTADDR_PRESENT; in hme_setup_mac_address()
3583 ether_bcopy(prop, &hmep->hme_factaddr); in hme_setup_mac_address()
3584 HME_FAULT_MSG2(hmep, SEVERITY_NONE, DISPLAY_MSG, in hme_setup_mac_address()
3586 ether_sprintf(&hmep->hme_factaddr)); in hme_setup_mac_address()
3598 ether_bcopy(prop, &hmep->hme_ouraddr); in hme_setup_mac_address()
3614 (hmep->hme_addrflags & HME_FACTADDR_PRESENT)) { in hme_setup_mac_address()
3615 hmep->hme_addrflags |= HME_FACTADDR_USE; in hme_setup_mac_address()
3616 ether_bcopy(&hmep->hme_factaddr, &hmep->hme_ouraddr); in hme_setup_mac_address()
3618 HME_FAULT_MSG1(hmep, SEVERITY_NONE, DISPLAY_MSG, in hme_setup_mac_address()
3628 (void) localetheraddr((struct ether_addr *)NULL, &hmep->hme_ouraddr); in hme_setup_mac_address()
3630 ether_bcopy(&hmep->hme_factaddr, &hmep->hme_ouraddr); in hme_setup_mac_address()
3636 hme_check_acc_handle(char *file, uint_t line, struct hme *hmep, in hme_check_acc_handle() argument