src/dpdk/drivers/net/txgbe/base/txgbe_mng.c
static s32
txgbe_hic_unlocked(struct txgbe_hw *hw, u32 *buffer, u32 length, u32 timeout)
{
	u32 value, loop;
	u16 i, dword_len;

	DEBUGFUNC("txgbe_hic_unlocked");

	if (!length || length > TXGBE_PMMBX_BSIZE) {
		DEBUGOUT("Buffer length failure buffersize=%d.\n", length);
		return TXGBE_ERR_HOST_INTERFACE_COMMAND;
	}

	/* Calculate length in DWORDs. We must be DWORD aligned */
	if (length % sizeof(u32)) {
		DEBUGOUT("Buffer length failure, not aligned to dword");
		return TXGBE_ERR_INVALID_ARGUMENT;
	}

	dword_len = length >> 2;

	/* The device driver writes the relevant command block
	 * into the ram area.
	 */
	for (i = 0; i < dword_len; i++) {
		wr32a(hw, TXGBE_MNGMBX, i, cpu_to_le32(buffer[i]));
		buffer[i] = rd32a(hw, TXGBE_MNGMBX, i);
	}
	txgbe_flush(hw);

	/* Setting this bit tells the ARC that a new command is pending. */
	wr32m(hw, TXGBE_MNGMBXCTL,
	      TXGBE_MNGMBXCTL_SWRDY, TXGBE_MNGMBXCTL_SWRDY);

	/* Check command completion */
	loop = po32m(hw, TXGBE_MNGMBXCTL,
		TXGBE_MNGMBXCTL_FWRDY, TXGBE_MNGMBXCTL_FWRDY,
		&value, timeout, 1000);
	if (!loop || !(value & TXGBE_MNGMBXCTL_FWACK)) {
		DEBUGOUT("Command has failed with no status valid.\n");
		return TXGBE_ERR_HOST_INTERFACE_COMMAND;
	}

	return 0;
}
/**
 *  txgbe_hic_unlocked - Issue command to manageability block unlocked
 *  @hw: pointer to the HW structure
 *  @buffer: command to write and where the return status will be placed
 *  @length: length of buffer, must be multiple of 4 bytes
 *  @timeout: time in ms to wait for command completion
 *
 *  Communicates with the manageability block. On success return 0
 *  else returns semaphore error when encountering an error acquiring
 *  semaphore or TXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.
 *
 *  This function assumes that the TXGBE_MNGSEM_SWMBX semaphore is held
 *  by the caller.
 **/
Issue command to manageability block unlocked
@hw: pointer to the HW structure
@buffer: command to write and where the return status will be placed
@length: length of buffer, must be multiple of 4 bytes
@timeout: time in ms to wait for command completion

Communicates with the manageability block. On success return 0
else returns semaphore error when encountering an error acquiring
semaphore or TXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.

This function assumes that the TXGBE_MNGSEM_SWMBX semaphore is held
by the caller.
Issue command to manageability block unlocked @hw : pointer to the HW structure @buffer : command to write and where the return status will be placed @length : length of buffer must be multiple of 4 bytes @timeout : time in ms to wait for command completion Communicates with the manageability block . On success return 0 else returns semaphore error when encountering an error acquiring semaphore or TXGBE_ERR_HOST_INTERFACE_COMMAND when command fails . This function assumes that the TXGBE_MNGSEM_SWMBX semaphore is held by the caller .
static s32
txgbe_hic_unlocked(struct txgbe_hw *hw, u32 *buffer, u32 length, u32 timeout)
{
	u32 value, loop;
	u16 i, dword_len;
	DEBUGFUNC("txgbe_hic_unlocked");
	if (!length || length > TXGBE_PMMBX_BSIZE) {
		DEBUGOUT("Buffer length failure buffersize=%d.\n", length);
		return TXGBE_ERR_HOST_INTERFACE_COMMAND;
	}
	if (length % sizeof(u32)) {
		DEBUGOUT("Buffer length failure, not aligned to dword");
		return TXGBE_ERR_INVALID_ARGUMENT;
	}
	dword_len = length >> 2;
	for (i = 0; i < dword_len; i++) {
		wr32a(hw, TXGBE_MNGMBX, i, cpu_to_le32(buffer[i]));
		buffer[i] = rd32a(hw, TXGBE_MNGMBX, i);
	}
	txgbe_flush(hw);
	wr32m(hw, TXGBE_MNGMBXCTL,
	      TXGBE_MNGMBXCTL_SWRDY, TXGBE_MNGMBXCTL_SWRDY);
	loop = po32m(hw, TXGBE_MNGMBXCTL,
		TXGBE_MNGMBXCTL_FWRDY, TXGBE_MNGMBXCTL_FWRDY,
		&value, timeout, 1000);
	if (!loop || !(value & TXGBE_MNGMBXCTL_FWACK)) {
		DEBUGOUT("Command has failed with no status valid.\n");
		return TXGBE_ERR_HOST_INTERFACE_COMMAND;
	}
	return 0;
}
static s32 txgbe_hic_unlocked ( struct txgbe_hw * hw , u32 * buffer , u32 length , u32 timeout ) { u32 value , loop ; u16 i , dword_len ; DEBUGFUNC ( " " ) ; if ( ! length || length > TXGBE_PMMBX_BSIZE ) { DEBUGOUT ( " \n " , length ) ; return TXGBE_ERR_HOST_INTERFACE_COMMAND ; } if ( length % sizeof ( u32 ) ) { DEBUGOUT ( " " ) ; return TXGBE_ERR_INVALID_ARGUMENT ; } dword_len = length >> 2 ; for ( i = 0 ; i < dword_len ; i ++ ) { wr32a ( hw , TXGBE_MNGMBX , i , cpu_to_le32 ( buffer [ i ] ) ) ; buffer [ i ] = rd32a ( hw , TXGBE_MNGMBX , i ) ; } txgbe_flush ( hw ) ; wr32m ( hw , TXGBE_MNGMBXCTL , TXGBE_MNGMBXCTL_SWRDY , TXGBE_MNGMBXCTL_SWRDY ) ; loop = po32m ( hw , TXGBE_MNGMBXCTL , TXGBE_MNGMBXCTL_FWRDY , TXGBE_MNGMBXCTL_FWRDY , & value , timeout , 1000 ) ; if ( ! loop || ! ( value & TXGBE_MNGMBXCTL_FWACK ) ) { DEBUGOUT ( " \n " ) ; return TXGBE_ERR_HOST_INTERFACE_COMMAND ; } return 0 ; }
txgbe_hic_unlocked - Issue command to manageability block unlocked
  @hw: pointer to the HW structure
  @buffer: command to write and where the return status will be placed
  @length: length of buffer, must be multiple of 4 bytes
  @timeout: time in ms to wait for command completion
txgbe_hic_unlocked - Issue command to manageability block unlocked @hw : pointer to the HW structure @buffer : command to write and where the return status will be placed @length : length of buffer must be multiple of 4 bytes @timeout : time in ms to wait for command completion
/* Calculate length in DWORDs. We must be DWORD aligned */ /* The device driver writes the relevant command block
	 * into the ram area.
	 */ /* Setting this bit tells the ARC that a new command is pending. */ /* Check command completion */