Exemplo n.º 1
0
int
efe_suspend(efe_t *efep)
{
	mutex_enter(&efep->efe_intrlock);
	mutex_enter(&efep->efe_txlock);

	if (efep->efe_flags & FLAG_RUNNING) {
		efe_stop(efep);
	}
	efep->efe_flags |= FLAG_SUSPENDED;

	mutex_exit(&efep->efe_txlock);
	mutex_exit(&efep->efe_intrlock);

	mii_suspend(efep->efe_miih);

	return (DDI_SUCCESS);
}
Exemplo n.º 2
0
int
pcn_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
{
	pcn_t	*pcnp;

	pcnp = ddi_get_soft_state(pcn_ssp, ddi_get_instance(dip));

	if (pcnp == NULL) {
		pcn_error(dip, "no soft state in detach!");
		return (DDI_FAILURE);
	}

	switch (cmd) {
	case DDI_DETACH:
		if (mac_unregister(pcnp->pcn_mh) != 0)
			return (DDI_FAILURE);

		mutex_enter(&pcnp->pcn_intrlock);
		mutex_enter(&pcnp->pcn_xmtlock);
		pcnp->pcn_flags &= ~PCN_RUNNING;
		pcn_stopall(pcnp);
		mutex_exit(&pcnp->pcn_xmtlock);
		mutex_exit(&pcnp->pcn_intrlock);

		pcn_teardown(pcnp);
		return (DDI_SUCCESS);

	case DDI_SUSPEND:
		mii_suspend(pcnp->pcn_mii);

		mutex_enter(&pcnp->pcn_intrlock);
		mutex_enter(&pcnp->pcn_xmtlock);
		pcnp->pcn_flags |= PCN_SUSPENDED;
		pcn_stopall(pcnp);
		mutex_exit(&pcnp->pcn_xmtlock);
		mutex_exit(&pcnp->pcn_intrlock);
		return (DDI_SUCCESS);

	default:
		return (DDI_FAILURE);
	}
}