FreeBSD/sys/dev/e1000/if_lem.c
/*
** Parse the interface capabilities with regard
** to both system management and wake-on-lan for
** later use.
*/
Parse the interface capabilities with regard
to both system management and wake-on-lan for
later use.
Parse the interface capabilities with regard to both system management and wake - on - lan for later use .
static void
lem_get_wakeup(device_t dev)
{
	struct adapter	*adapter = device_get_softc(dev);
	u16		eeprom_data = 0, device_id, apme_mask;
	adapter->has_manage = e1000_enable_mng_pass_thru(&adapter->hw);
	apme_mask = EM_EEPROM_APME;
	switch (adapter->hw.mac.type) {
	case e1000_82542:
	case e1000_82543:
		break;
	case e1000_82544:
		e1000_read_nvm(&adapter->hw,
		    NVM_INIT_CONTROL2_REG, 1, &eeprom_data);
		apme_mask = EM_82544_APME;
		break;
	case e1000_82546:
	case e1000_82546_rev_3:
		if (adapter->hw.bus.func == 1) {
			e1000_read_nvm(&adapter->hw,
			    NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
			break;
		} else
			e1000_read_nvm(&adapter->hw,
			    NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
		break;
	default:
		e1000_read_nvm(&adapter->hw,
		    NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
		break;
	}
	if (eeprom_data & apme_mask)
		adapter->wol = (E1000_WUFC_MAG | E1000_WUFC_MC);
	device_id = pci_get_device(dev);
        switch (device_id) {
	case E1000_DEV_ID_82546GB_PCIE:
		adapter->wol = 0;
		break;
	case E1000_DEV_ID_82546EB_FIBER:
	case E1000_DEV_ID_82546GB_FIBER:
		if (E1000_READ_REG(&adapter->hw, E1000_STATUS) &
		    E1000_STATUS_FUNC_1)
			adapter->wol = 0;
		break;
	case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
		if (global_quad_port_a != 0)
			adapter->wol = 0;
		if (++global_quad_port_a == 4)
			global_quad_port_a = 0;
                break;
	}
	return;
}
static void lem_get_wakeup ( device_t dev ) { struct adapter * adapter = device_get_softc ( dev ) ; u16 eeprom_data = 0 , device_id , apme_mask ; adapter -> has_manage = e1000_enable_mng_pass_thru ( & adapter -> hw ) ; apme_mask = EM_EEPROM_APME ; switch ( adapter -> hw . mac . type ) { case e1000_82542 : case e1000_82543 : break ; case e1000_82544 : e1000_read_nvm ( & adapter -> hw , NVM_INIT_CONTROL2_REG , 1 , & eeprom_data ) ; apme_mask = EM_82544_APME ; break ; case e1000_82546 : case e1000_82546_rev_3 : if ( adapter -> hw . bus . func == 1 ) { e1000_read_nvm ( & adapter -> hw , NVM_INIT_CONTROL3_PORT_B , 1 , & eeprom_data ) ; break ; } else e1000_read_nvm ( & adapter -> hw , NVM_INIT_CONTROL3_PORT_A , 1 , & eeprom_data ) ; break ; default : e1000_read_nvm ( & adapter -> hw , NVM_INIT_CONTROL3_PORT_A , 1 , & eeprom_data ) ; break ; } if ( eeprom_data & apme_mask ) adapter -> wol = ( E1000_WUFC_MAG | E1000_WUFC_MC ) ; device_id = pci_get_device ( dev ) ; switch ( device_id ) { case E1000_DEV_ID_82546GB_PCIE : adapter -> wol = 0 ; break ; case E1000_DEV_ID_82546EB_FIBER : case E1000_DEV_ID_82546GB_FIBER : if ( E1000_READ_REG ( & adapter -> hw , E1000_STATUS ) & E1000_STATUS_FUNC_1 ) adapter -> wol = 0 ; break ; case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 : if ( global_quad_port_a != 0 ) adapter -> wol = 0 ; if ( ++ global_quad_port_a == 4 ) global_quad_port_a = 0 ; break ; } return ; }
Parse the interface capabilities with regard
to both system management and wake-on-lan for
later use.
Parse the interface capabilities with regard to both system management and wake - on - lan for later use .
/*
         * We have the eeprom settings, now apply the special cases
         * where the eeprom may be wrong or the board won't support
         * wake on lan on a particular port
	 */ /* Wake events only supported on port A for dual fiber
		 * regardless of eeprom setting */ /* if quad port adapter, disable WoL on all but port A */ /* Reset for multiple quad port adapters */