/* Reads the port error status CSR for a particular switch port to determine if the port has an active link. Returns PORT_N_ERR_STS_PORT_OK if the port is active or %0 if it is inactive.  */
static int rio_sport_is_active(struct rio_mport *port, u16 destid, u8 hopcount, int sport)
/* Reads the port error status CSR for a particular switch port to determine if the port has an active link. Returns PORT_N_ERR_STS_PORT_OK if the port is active or %0 if it is inactive.  */
static int rio_sport_is_active(struct rio_mport *port, u16 destid, u8 hopcount, int sport)
{
	u32 result;
	u32 ext_ftr_ptr;
	int *entry = rio_sport_phys_table;
	do {
		if ((ext_ftr_ptr =
		     rio_mport_get_feature(port, 0, destid, hopcount, *entry)))
			break;
	} while (*++entry >= 0);
	if (ext_ftr_ptr)
		rio_mport_read_config_32(port, destid, hopcount,
					 ext_ftr_ptr +
					 RIO_PORT_N_ERR_STS_CSR(sport),
					 &result);
	return (result & PORT_N_ERR_STS_PORT_OK);
}