FreeBSD/sys/dev/cxgbe/common/t4_hw.c
/**
 *	t4_wol_magic_enable - enable/disable magic packet WoL
 *	@adap: the adapter
 *	@port: the physical port index
 *	@addr: MAC address expected in magic packets, %NULL to disable
 *
 *	Enables/disables magic packet wake-on-LAN for the selected port.
 */
enable/disable magic packet WoL
@adap: the adapter
@port: the physical port index
@addr: MAC address expected in magic packets, %NULL to disable

Enables/disables magic packet wake-on-LAN for the selected port.
enable / disable magic packet WoL @adap : the adapter @port : the physical port index @addr : MAC address expected in magic packets %NULL to disable Enables / disables magic packet wake - on - LAN for the selected port .
void t4_wol_magic_enable(struct adapter *adap, unsigned int port,
			 const u8 *addr)
{
	u32 mag_id_reg_l, mag_id_reg_h, port_cfg_reg;
	if (is_t4(adap)) {
		mag_id_reg_l = PORT_REG(port, A_XGMAC_PORT_MAGIC_MACID_LO);
		mag_id_reg_h = PORT_REG(port, A_XGMAC_PORT_MAGIC_MACID_HI);
		port_cfg_reg = PORT_REG(port, A_XGMAC_PORT_CFG2);
	} else {
		mag_id_reg_l = T5_PORT_REG(port, A_MAC_PORT_MAGIC_MACID_LO);
		mag_id_reg_h = T5_PORT_REG(port, A_MAC_PORT_MAGIC_MACID_HI);
		port_cfg_reg = T5_PORT_REG(port, A_MAC_PORT_CFG2);
	}
	if (addr) {
		t4_write_reg(adap, mag_id_reg_l,
			     (addr[2] << 24) | (addr[3] << 16) |
			     (addr[4] << 8) | addr[5]);
		t4_write_reg(adap, mag_id_reg_h,
			     (addr[0] << 8) | addr[1]);
	}
	t4_set_reg_field(adap, port_cfg_reg, F_MAGICEN,
			 V_MAGICEN(addr != NULL));
}
void t4_wol_magic_enable ( struct adapter * adap , unsigned int port , const u8 * addr ) { u32 mag_id_reg_l , mag_id_reg_h , port_cfg_reg ; if ( is_t4 ( adap ) ) { mag_id_reg_l = PORT_REG ( port , A_XGMAC_PORT_MAGIC_MACID_LO ) ; mag_id_reg_h = PORT_REG ( port , A_XGMAC_PORT_MAGIC_MACID_HI ) ; port_cfg_reg = PORT_REG ( port , A_XGMAC_PORT_CFG2 ) ; } else { mag_id_reg_l = T5_PORT_REG ( port , A_MAC_PORT_MAGIC_MACID_LO ) ; mag_id_reg_h = T5_PORT_REG ( port , A_MAC_PORT_MAGIC_MACID_HI ) ; port_cfg_reg = T5_PORT_REG ( port , A_MAC_PORT_CFG2 ) ; } if ( addr ) { t4_write_reg ( adap , mag_id_reg_l , ( addr [ 2 ] << 24 ) | ( addr [ 3 ] << 16 ) | ( addr [ 4 ] << 8 ) | addr [ 5 ] ) ; t4_write_reg ( adap , mag_id_reg_h , ( addr [ 0 ] << 8 ) | addr [ 1 ] ) ; } t4_set_reg_field ( adap , port_cfg_reg , F_MAGICEN , V_MAGICEN ( addr != NULL ) ) ; }
t4_wol_magic_enable - enable/disable magic packet WoL
      @adap: the adapter
      @port: the physical port index
      @addr: MAC address expected in magic packets, %NULL to disable
t4_wol_magic_enable - enable / disable magic packet WoL @adap : the adapter @port : the physical port index @addr : MAC address expected in magic packets %NULL to disable