714 */
715 for (i = 0; i < 32; i++) {
716 if ((phydata = mac->phys[i]) != 0) {
717 state = mii_linkup(mac, i) ?
718 phy_state_linkup : phy_state_linkdown;
719 if (state != phydata->state) {
720 #ifdef MIIDEBUG
721 if (miidebug)
722 cmn_err(CE_NOTE, "%s: PHY %d link %s",
723 ddi_get_name(mac->mii_dip), i,
724 state == phy_state_linkup ?
725 "up" : "down");
726 #endif
727 phydata->state = state;
728 mac->mii_linknotify(mac->mii_dip, i, state);
729 }
730 }
731 }
732 /* Check the ports every 5 seconds */
733 mac->portmon_timer = timeout((void (*)(void*))mii_portmon, (void *)mac,
734 (clock_t)(5 * drv_usectohz(1000000)));
735 if (mac->lock)
736 mutex_exit(mac->lock);
737 }
738
739 /*
740 * Close a handle to the MII interface from a registered user
741 */
742
743 void
744 mii_destroy(mii_handle_t mac)
745 {
746 /* Free per-PHY information */
747 int i;
748
749 (void) mii_stop_portmon(mac);
750
751 for (i = 0; i < 32; i++)
752 if (mac->phys[i])
753 kmem_free(mac->phys[i], sizeof (struct phydata));
754
|
714 */
715 for (i = 0; i < 32; i++) {
716 if ((phydata = mac->phys[i]) != 0) {
717 state = mii_linkup(mac, i) ?
718 phy_state_linkup : phy_state_linkdown;
719 if (state != phydata->state) {
720 #ifdef MIIDEBUG
721 if (miidebug)
722 cmn_err(CE_NOTE, "%s: PHY %d link %s",
723 ddi_get_name(mac->mii_dip), i,
724 state == phy_state_linkup ?
725 "up" : "down");
726 #endif
727 phydata->state = state;
728 mac->mii_linknotify(mac->mii_dip, i, state);
729 }
730 }
731 }
732 /* Check the ports every 5 seconds */
733 mac->portmon_timer = timeout((void (*)(void*))mii_portmon, (void *)mac,
734 drv_sectohz(5));
735 if (mac->lock)
736 mutex_exit(mac->lock);
737 }
738
739 /*
740 * Close a handle to the MII interface from a registered user
741 */
742
743 void
744 mii_destroy(mii_handle_t mac)
745 {
746 /* Free per-PHY information */
747 int i;
748
749 (void) mii_stop_portmon(mac);
750
751 for (i = 0; i < 32; i++)
752 if (mac->phys[i])
753 kmem_free(mac->phys[i], sizeof (struct phydata));
754
|