Skip to content
Snippets Groups Projects
tsec.c 50.7 KiB
Newer Older
  • Learn to ignore specific revisions
  • David Updegraff's avatar
    David Updegraff committed
     * hash index which gaddr register to use, and the 5 other bits
     * indicate which bit (assuming an IBM numbering scheme, which
     * for PowerPC (tm) is usually the case) in the tregister holds
     * the entry. */
    static int
    tsec_mcast_addr (struct eth_device *dev, u8 mcast_mac, u8 set)
    {
    
    Peter Tyser's avatar
    Peter Tyser committed
    	struct tsec_private *priv = privlist[1];
    	volatile tsec_t *regs = priv->regs;
    	volatile u32  *reg_array, value;
    	u8 result, whichbit, whichreg;
    
    David Updegraff's avatar
    David Updegraff committed
    
    	result = (u8)((ether_crc(MAC_ADDR_LEN,mcast_mac) >> 24) & 0xff);
    	whichbit = result & 0x1f;	/* the 5 LSB = which bit to set */
    	whichreg = result >> 5;		/* the 3 MSB = which reg to set it in */
    	value = (1 << (31-whichbit));
    
    	reg_array = &(regs->hash.gaddr0);
    
    	if (set) {
    		reg_array[whichreg] |= value;
    	} else {
    		reg_array[whichreg] &= ~value;
    	}
    	return 0;
    }
    #endif /* Multicast TFTP ? */