kernels/linux-2.4.0/drivers/net/tlan.c
/***************************************************************
	 *	TLan_HandleStatusCheck
	 *
	 *	Returns:
	 *		0 if Adapter check, 1 if Network Status check.
	 *	Parms:
	 *		dev		Device assigned the IRQ that was
	 *				raised.
	 *		host_int	The contents of the HOST_INT
	 *				port.
	 *
	 *	This function handles Adapter Check/Network Status
	 *	interrupts generated by the adapter.  It checks the
	 *	vector in the HOST_INT register to determine if it is
	 *	an Adapter Check interrupt.  If so, it resets the
	 *	adapter.  Otherwise it clears the status registers
	 *	and services the PHY.
	 *
	 **************************************************************/
TLan_HandleStatusCheck
Returns:
0 if Adapter check, 1 if Network Status check.
Parms:
dev             Device assigned the IRQ that was
raised.
host_int        The contents of the HOST_INT
port.

This function handles Adapter Check/Network Status
interrupts generated by the adapter.  It checks the
vector in the HOST_INT register to determine if it is
an Adapter Check interrupt.  If so, it resets the
adapter.  Otherwise it clears the status registers
and services the PHY.
TLan_HandleStatusCheck Returns : 0 if Adapter check 1 if Network Status check . Parms : dev Device assigned the IRQ that was raised . host_int The contents of the HOST_INT port . This function handles Adapter Check / Network Status interrupts generated by the adapter . It checks the vector in the HOST_INT register to determine if it is an Adapter Check interrupt . If so it resets the adapter . Otherwise it clears the status registers and services the PHY .
u32 TLan_HandleStatusCheck( struct net_device *dev, u16 host_int )
{	
	TLanPrivateInfo	*priv = (TLanPrivateInfo *) dev->priv;
	u32		ack;
	u32		error;
	u8		net_sts;
	u32		phy;
	u16		tlphy_ctl;
	u16		tlphy_sts;
	ack = 1;
	if ( host_int & TLAN_HI_IV_MASK ) {
		error = inl( dev->base_addr + TLAN_CH_PARM );
		printk( "TLAN:  %s: Adaptor Error = 0x%x\n", dev->name, error );
		TLan_ReadAndClearStats( dev, TLAN_RECORD );
		outl( TLAN_HC_AD_RST, dev->base_addr + TLAN_HOST_CMD );
		TLan_FreeLists( dev );
		TLan_ResetLists( dev );
		TLan_ResetAdapter( dev );
		netif_start_queue(dev);
		ack = 0;
	} else {
		TLAN_DBG( TLAN_DEBUG_GNRL, "%s: Status Check\n", dev->name );
		phy = priv->phy[priv->phyNum];
		net_sts = TLan_DioRead8( dev->base_addr, TLAN_NET_STS );
		if ( net_sts ) {
			TLan_DioWrite8( dev->base_addr, TLAN_NET_STS, net_sts );
			TLAN_DBG( TLAN_DEBUG_GNRL, "%s:    Net_Sts = %x\n", dev->name, (unsigned) net_sts );
		}
		if ( ( net_sts & TLAN_NET_STS_MIRQ ) &&  ( priv->phyNum == 0 ) ) {
			TLan_MiiReadReg( dev, phy, TLAN_TLPHY_STS, &tlphy_sts );
			TLan_MiiReadReg( dev, phy, TLAN_TLPHY_CTL, &tlphy_ctl );
        		if ( ! ( tlphy_sts & TLAN_TS_POLOK ) && ! ( tlphy_ctl & TLAN_TC_SWAPOL ) ) {
                		tlphy_ctl |= TLAN_TC_SWAPOL;
                		TLan_MiiWriteReg( dev, phy, TLAN_TLPHY_CTL, tlphy_ctl);
        		} else if ( ( tlphy_sts & TLAN_TS_POLOK ) && ( tlphy_ctl & TLAN_TC_SWAPOL ) ) {
                		tlphy_ctl &= ~TLAN_TC_SWAPOL;
                		TLan_MiiWriteReg( dev, phy, TLAN_TLPHY_CTL, tlphy_ctl);
        		}
			if (debug) {
				TLan_PhyPrint( dev );		
			}
		}
	}
	return ack;
}
u32 TLan_HandleStatusCheck ( struct net_device * dev , u16 host_int ) { TLanPrivateInfo * priv = ( TLanPrivateInfo * ) dev -> priv ; u32 ack ; u32 error ; u8 net_sts ; u32 phy ; u16 tlphy_ctl ; u16 tlphy_sts ; ack = 1 ; if ( host_int & TLAN_HI_IV_MASK ) { error = inl ( dev -> base_addr + TLAN_CH_PARM ) ; printk ( " \n " , dev -> name , error ) ; TLan_ReadAndClearStats ( dev , TLAN_RECORD ) ; outl ( TLAN_HC_AD_RST , dev -> base_addr + TLAN_HOST_CMD ) ; TLan_FreeLists ( dev ) ; TLan_ResetLists ( dev ) ; TLan_ResetAdapter ( dev ) ; netif_start_queue ( dev ) ; ack = 0 ; } else { TLAN_DBG ( TLAN_DEBUG_GNRL , " \n " , dev -> name ) ; phy = priv -> phy [ priv -> phyNum ] ; net_sts = TLan_DioRead8 ( dev -> base_addr , TLAN_NET_STS ) ; if ( net_sts ) { TLan_DioWrite8 ( dev -> base_addr , TLAN_NET_STS , net_sts ) ; TLAN_DBG ( TLAN_DEBUG_GNRL , " \n " , dev -> name , ( unsigned ) net_sts ) ; } if ( ( net_sts & TLAN_NET_STS_MIRQ ) && ( priv -> phyNum == 0 ) ) { TLan_MiiReadReg ( dev , phy , TLAN_TLPHY_STS , & tlphy_sts ) ; TLan_MiiReadReg ( dev , phy , TLAN_TLPHY_CTL , & tlphy_ctl ) ; if ( ! ( tlphy_sts & TLAN_TS_POLOK ) && ! ( tlphy_ctl & TLAN_TC_SWAPOL ) ) { tlphy_ctl |= TLAN_TC_SWAPOL ; TLan_MiiWriteReg ( dev , phy , TLAN_TLPHY_CTL , tlphy_ctl ) ; } else if ( ( tlphy_sts & TLAN_TS_POLOK ) && ( tlphy_ctl & TLAN_TC_SWAPOL ) ) { tlphy_ctl &= ~ TLAN_TC_SWAPOL ; TLan_MiiWriteReg ( dev , phy , TLAN_TLPHY_CTL , tlphy_ctl ) ; } if ( debug ) { TLan_PhyPrint ( dev ) ; } } } return ack ; }
TLan_HandleStatusCheck
      Returns:
              0 if Adapter check, 1 if Network Status check.
TLan_HandleStatusCheck Returns : 0 if Adapter check 1 if Network Status check .