FreeBSD/sys/powerpc/mpc85xx/lbc.c
/*
 * Calculate address mask used by OR(n) registers. Use memory region size to
 * determine mask value. The size must be a power of two and within the range
 * of 32KB - 4GB. Otherwise error code is returned. Value representing
 * 4GB size can be passed as 0xffffffff.
 */
Calculate address mask used by OR(n) registers. Use memory region size to
determine mask value. The size must be a power of two and within the range
of 32KB - 4GB. Otherwise error code is returned. Value representing
4GB size can be passed as 0xffffffff.
Calculate address mask used by OR ( n ) registers . Use memory region size to determine mask value . The size must be a power of two and within the range of 32KB - 4GB . Otherwise error code is returned . Value representing 4GB size can be passed as 0xffffffff .
static uint32_t
lbc_address_mask(uint32_t size)
{
	int n = 15;
	if (size == ~0)
		return (0);
	while (n < 32) {
		if (size == (1U << n))
			break;
		n++;
	}
	if (n == 32)
		return (EINVAL);
	return (0xffff8000 << (n - 15));
}
static uint32_t lbc_address_mask ( uint32_t size ) { int n = 15 ; if ( size == ~ 0 ) return ( 0 ) ; while ( n < 32 ) { if ( size == ( 1U << n ) ) break ; n ++ ; } if ( n == 32 ) return ( EINVAL ) ; return ( 0xffff8000 << ( n - 15 ) ) ; }
Calculate address mask used by OR(n) registers.
Calculate address mask used by OR ( n ) registers .