FreeBSD/sys/dev/ntb/ntb_hw/ntb_hw.c
/*
 * Polls the HW link status register(s); returns true if something has changed.
 */
Polls the HW link status register(s); returns true if something has changed.
Polls the HW link status register ( s ) ; returns true if something has changed .
static bool
ntb_poll_link(struct ntb_softc *ntb)
{
	uint32_t ntb_cntl;
	uint16_t reg_val;
	if (ntb->type == NTB_ATOM) {
		ntb_cntl = ntb_reg_read(4, ntb->reg->ntb_ctl);
		if (ntb_cntl == ntb->ntb_ctl)
			return (false);
		ntb->ntb_ctl = ntb_cntl;
		ntb->lnk_sta = ntb_reg_read(4, ntb->reg->lnk_sta);
	} else {
		db_iowrite_raw(ntb, ntb->self_reg->db_bell, ntb->db_link_mask);
		reg_val = pci_read_config(ntb->device, ntb->reg->lnk_sta, 2);
		if (reg_val == ntb->lnk_sta)
			return (false);
		ntb->lnk_sta = reg_val;
		if (HAS_FEATURE(NTB_SB01BASE_LOCKUP)) {
			if (_xeon_link_is_up(ntb)) {
				if (!ntb->peer_msix_good) {
					callout_reset(&ntb->peer_msix_work, 0,
					    ntb_exchange_msix, ntb);
					return (false);
				}
			} else {
				ntb->peer_msix_good = false;
				ntb->peer_msix_done = false;
			}
		}
	}
	return (true);
}
static bool ntb_poll_link ( struct ntb_softc * ntb ) { uint32_t ntb_cntl ; uint16_t reg_val ; if ( ntb -> type == NTB_ATOM ) { ntb_cntl = ntb_reg_read ( 4 , ntb -> reg -> ntb_ctl ) ; if ( ntb_cntl == ntb -> ntb_ctl ) return ( false ) ; ntb -> ntb_ctl = ntb_cntl ; ntb -> lnk_sta = ntb_reg_read ( 4 , ntb -> reg -> lnk_sta ) ; } else { db_iowrite_raw ( ntb , ntb -> self_reg -> db_bell , ntb -> db_link_mask ) ; reg_val = pci_read_config ( ntb -> device , ntb -> reg -> lnk_sta , 2 ) ; if ( reg_val == ntb -> lnk_sta ) return ( false ) ; ntb -> lnk_sta = reg_val ; if ( HAS_FEATURE ( NTB_SB01BASE_LOCKUP ) ) { if ( _xeon_link_is_up ( ntb ) ) { if ( ! ntb -> peer_msix_good ) { callout_reset ( & ntb -> peer_msix_work , 0 , ntb_exchange_msix , ntb ) ; return ( false ) ; } } else { ntb -> peer_msix_good = false ; ntb -> peer_msix_done = false ; } } } return ( true ) ; }
Polls the HW link status register(s); returns true if something has changed.
Polls the HW link status register ( s ) ; returns true if something has changed .