src/dpdk/drivers/net/ixgbe/base/ixgbe_x550.c
s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
			   u32 device_type, u32 *data)
{
	u32 gssr = IXGBE_GSSR_PHY1_SM | IXGBE_GSSR_PHY0_SM;
	u32 command, error;
	s32 ret;

	ret = ixgbe_acquire_swfw_semaphore(hw, gssr);
	if (ret != IXGBE_SUCCESS)
		return ret;

	ret = ixgbe_iosf_wait(hw, NULL);
	if (ret != IXGBE_SUCCESS)
		goto out;

	command = ((reg_addr << IXGBE_SB_IOSF_CTRL_ADDR_SHIFT) |
		   (device_type << IXGBE_SB_IOSF_CTRL_TARGET_SELECT_SHIFT));

	/* Write IOSF control register */
	IXGBE_WRITE_REG(hw, IXGBE_SB_IOSF_INDIRECT_CTRL, command);

	ret = ixgbe_iosf_wait(hw, &command);

	if ((command & IXGBE_SB_IOSF_CTRL_RESP_STAT_MASK) != 0) {
		error = (command & IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK) >>
			 IXGBE_SB_IOSF_CTRL_CMPL_ERR_SHIFT;
		ERROR_REPORT2(IXGBE_ERROR_POLLING,
				"Failed to read, error %x\n", error);
		ret = IXGBE_ERR_PHY;
	}

	if (ret == IXGBE_SUCCESS)
		*data = IXGBE_READ_REG(hw, IXGBE_SB_IOSF_INDIRECT_DATA);

out:
	ixgbe_release_swfw_semaphore(hw, gssr);
	return ret;
}
/**
 * ixgbe_read_iosf_sb_reg_x550 - Reads specified register of the IOSF device
 * @hw: pointer to hardware structure
 * @reg_addr: 32 bit PHY register to write
 * @device_type: 3 bit device type
 * @data: Pointer to read data from the register
 **/
Reads specified register of the IOSF device
@hw: pointer to hardware structure
@reg_addr: 32 bit PHY register to write
@device_type: 3 bit device type
@data: Pointer to read data from the register
Reads specified register of the IOSF device @hw : pointer to hardware structure @reg_addr : 32 bit PHY register to write @device_type : 3 bit device type @data : Pointer to read data from the register
s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
			   u32 device_type, u32 *data)
{
	u32 gssr = IXGBE_GSSR_PHY1_SM | IXGBE_GSSR_PHY0_SM;
	u32 command, error;
	s32 ret;
	ret = ixgbe_acquire_swfw_semaphore(hw, gssr);
	if (ret != IXGBE_SUCCESS)
		return ret;
	ret = ixgbe_iosf_wait(hw, NULL);
	if (ret != IXGBE_SUCCESS)
		goto out;
	command = ((reg_addr << IXGBE_SB_IOSF_CTRL_ADDR_SHIFT) |
		   (device_type << IXGBE_SB_IOSF_CTRL_TARGET_SELECT_SHIFT));
	IXGBE_WRITE_REG(hw, IXGBE_SB_IOSF_INDIRECT_CTRL, command);
	ret = ixgbe_iosf_wait(hw, &command);
	if ((command & IXGBE_SB_IOSF_CTRL_RESP_STAT_MASK) != 0) {
		error = (command & IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK) >>
			 IXGBE_SB_IOSF_CTRL_CMPL_ERR_SHIFT;
		ERROR_REPORT2(IXGBE_ERROR_POLLING,
				"Failed to read, error %x\n", error);
		ret = IXGBE_ERR_PHY;
	}
	if (ret == IXGBE_SUCCESS)
		*data = IXGBE_READ_REG(hw, IXGBE_SB_IOSF_INDIRECT_DATA);
out:
	ixgbe_release_swfw_semaphore(hw, gssr);
	return ret;
}
s32 ixgbe_read_iosf_sb_reg_x550 ( struct ixgbe_hw * hw , u32 reg_addr , u32 device_type , u32 * data ) { u32 gssr = IXGBE_GSSR_PHY1_SM | IXGBE_GSSR_PHY0_SM ; u32 command , error ; s32 ret ; ret = ixgbe_acquire_swfw_semaphore ( hw , gssr ) ; if ( ret != IXGBE_SUCCESS ) return ret ; ret = ixgbe_iosf_wait ( hw , NULL ) ; if ( ret != IXGBE_SUCCESS ) goto out ; command = ( ( reg_addr << IXGBE_SB_IOSF_CTRL_ADDR_SHIFT ) | ( device_type << IXGBE_SB_IOSF_CTRL_TARGET_SELECT_SHIFT ) ) ; IXGBE_WRITE_REG ( hw , IXGBE_SB_IOSF_INDIRECT_CTRL , command ) ; ret = ixgbe_iosf_wait ( hw , & command ) ; if ( ( command & IXGBE_SB_IOSF_CTRL_RESP_STAT_MASK ) != 0 ) { error = ( command & IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK ) >> IXGBE_SB_IOSF_CTRL_CMPL_ERR_SHIFT ; ERROR_REPORT2 ( IXGBE_ERROR_POLLING , " \n " , error ) ; ret = IXGBE_ERR_PHY ; } if ( ret == IXGBE_SUCCESS ) * data = IXGBE_READ_REG ( hw , IXGBE_SB_IOSF_INDIRECT_DATA ) ; out : ixgbe_release_swfw_semaphore ( hw , gssr ) ; return ret ; }
ixgbe_read_iosf_sb_reg_x550 - Reads specified register of the IOSF device
 @hw: pointer to hardware structure
 @reg_addr: 32 bit PHY register to write
 @device_type: 3 bit device type
 @data: Pointer to read data from the register
ixgbe_read_iosf_sb_reg_x550 - Reads specified register of the IOSF device @hw : pointer to hardware structure @reg_addr : 32 bit PHY register to write @device_type : 3 bit device type @data : Pointer to read data from the register
/* Write IOSF control register */