FreeBSD/sys/dev/ntb/ntb_hw/ntb_hw.c
/**
 * ntb_peer_spad_read() - read from the primary scratchpad register
 * @ntb: pointer to ntb_softc instance
 * @idx: index to scratchpad register, 0 based
 * @val: pointer to 32bit integer for storing the register value
 *
 * This function allows reading of the 32bit scratchpad register on
 * the primary (internal) side.
 *
 * RETURNS: An appropriate ERRNO error value on error, or zero for success.
 */
read from the primary scratchpad register
@ntb: pointer to ntb_softc instance
@idx: index to scratchpad register, 0 based
@val: pointer to 32bit integer for storing the register value

This function allows reading of the 32bit scratchpad register on
the primary (internal) side.

An appropriate ERRNO error value on error, or zero for success.
read from the primary scratchpad register @ntb : pointer to ntb_softc instance @idx : index to scratchpad register 0 based @val : pointer to 32bit integer for storing the register value This function allows reading of the 32bit scratchpad register on the primary ( internal ) side . An appropriate ERRNO error value on error or zero for success .
int
ntb_peer_spad_read(struct ntb_softc *ntb, unsigned int idx, uint32_t *val)
{
	if (idx >= ntb->spad_count)
		return (EINVAL);
	if (HAS_FEATURE(NTB_SDOORBELL_LOCKUP))
		*val = ntb_mw_read(4, XEON_SPAD_OFFSET + idx * 4);
	else
		*val = ntb_reg_read(4, ntb->peer_reg->spad + idx * 4);
	return (0);
}
int ntb_peer_spad_read ( struct ntb_softc * ntb , unsigned int idx , uint32_t * val ) { if ( idx >= ntb -> spad_count ) return ( EINVAL ) ; if ( HAS_FEATURE ( NTB_SDOORBELL_LOCKUP ) ) * val = ntb_mw_read ( 4 , XEON_SPAD_OFFSET + idx * 4 ) ; else * val = ntb_reg_read ( 4 , ntb -> peer_reg -> spad + idx * 4 ) ; return ( 0 ) ; }
ntb_peer_spad_read() - read from the primary scratchpad register
 @ntb: pointer to ntb_softc instance
 @idx: index to scratchpad register, 0 based
 @val: pointer to 32bit integer for storing the register value
ntb_peer_spad_read () - read from the primary scratchpad register @ntb : pointer to ntb_softc instance @idx : index to scratchpad register 0 based @val : pointer to 32bit integer for storing the register value