Esempio n. 1
0
/*
 * __hal_kdfc_swapper_set - Set the swapper bits for the kdfc.
 * @hldev: HAL device object.
 * @vp_id: Vpath Id
 *
 * Set the swapper bits appropriately for the vpath.
 *
 * Returns:  VXGE_HAL_OK - success.
 * VXGE_HAL_ERR_SWAPPER_CTRL - failed.
 *
 * See also: vxge_hal_status_e {}.
 */
vxge_hal_status_e
__hal_kdfc_swapper_set(
    vxge_hal_device_t *hldev,
    u32 vp_id)
{
	u64 val64;
	vxge_hal_vpath_reg_t *vpath_reg;
	vxge_hal_legacy_reg_t *legacy_reg;

	vxge_assert(hldev != NULL);

	vxge_hal_trace_log_vpath("==> %s:%s:%d",
	    __FILE__, __func__, __LINE__);

	vxge_hal_trace_log_vpath("hldev = 0x"VXGE_OS_STXFMT", vp_id = %d",
	    (ptr_t) hldev, vp_id);

	vpath_reg = ((__hal_device_t *) hldev)->vpath_reg[vp_id];
	legacy_reg = ((__hal_device_t *) hldev)->legacy_reg;

	val64 = vxge_os_pio_mem_read64(hldev->pdev, hldev->regh0,
	    &legacy_reg->pifm_wr_swap_en);

	if (val64 == VXGE_HAL_SWAPPER_WRITE_BYTE_SWAP_ENABLE) {

		val64 = vxge_os_pio_mem_read64(hldev->pdev, hldev->regh0,
		    &vpath_reg->kdfcctl_cfg0);

		vxge_os_wmb();

		val64 |= VXGE_HAL_KDFCCTL_CFG0_BYTE_SWAPEN_FIFO0 |
		    VXGE_HAL_KDFCCTL_CFG0_BYTE_SWAPEN_FIFO1 |
		    VXGE_HAL_KDFCCTL_CFG0_BYTE_SWAPEN_FIFO2;

		vxge_os_pio_mem_write64(hldev->pdev, hldev->regh0,
		    val64,
		    &vpath_reg->kdfcctl_cfg0);
		vxge_os_wmb();

	}

	vxge_hal_trace_log_vpath("<== %s:%s:%d  Result: 0",
	    __FILE__, __func__, __LINE__);

	return (VXGE_HAL_OK);
}
Esempio n. 2
0
/*
 * __hal_vpath_swapper_set - Set the swapper bits for the vpath.
 * @hldev: HAL device object.
 * @vp_id: Vpath Id
 *
 * Set the swapper bits appropriately for the vpath.
 *
 * Returns:  VXGE_HAL_OK - success.
 * VXGE_HAL_ERR_SWAPPER_CTRL - failed.
 *
 * See also: vxge_hal_status_e {}.
 */
vxge_hal_status_e
__hal_vpath_swapper_set(
    vxge_hal_device_t *hldev,
    u32 vp_id)
{
#if !defined(VXGE_OS_HOST_BIG_ENDIAN)
	u64 val64;
	vxge_hal_vpath_reg_t *vpath_reg;

	vxge_assert(hldev != NULL);

	vxge_hal_trace_log_vpath("==> %s:%s:%d",
	    __FILE__, __func__, __LINE__);

	vxge_hal_trace_log_vpath(
	    "hldev = 0x"VXGE_OS_STXFMT", vp_id = %d",
	    (ptr_t) hldev, vp_id);

	vpath_reg = ((__hal_device_t *) hldev)->vpath_reg[vp_id];

	val64 = vxge_os_pio_mem_read64(hldev->pdev, hldev->regh0,
	    &vpath_reg->vpath_general_cfg1);

	vxge_os_wmb();

	val64 |= VXGE_HAL_VPATH_GENERAL_CFG1_CTL_BYTE_SWAPEN;

	vxge_os_pio_mem_write64(hldev->pdev, hldev->regh0,
	    val64,
	    &vpath_reg->vpath_general_cfg1);
	vxge_os_wmb();


	vxge_hal_trace_log_vpath("<== %s:%s:%d  Result: 0",
	    __FILE__, __func__, __LINE__);
#endif
	return (VXGE_HAL_OK);
}
Esempio n. 3
0
/*
 * __hal_non_offload_db_reset - Reset non offload doorbell fifo
 *
 * @vpath_handle: vpath handle
 *
 * This function resets non-offload doorbell FIFO
 *
 */
vxge_hal_status_e
__hal_non_offload_db_reset(vxge_hal_vpath_h vpath_handle)
{
    vxge_hal_status_e status;
    __hal_device_t *hldev;
    __hal_vpath_handle_t *vp = (__hal_vpath_handle_t *) vpath_handle;

    vxge_assert(vpath_handle != NULL);

    hldev = (__hal_device_t *) vp->vpath->hldev;

    vxge_hal_trace_log_fifo("==> %s:%s:%d",
                            __FILE__, __func__, __LINE__);

    vxge_hal_trace_log_fifo(
        "vpath_handle = 0x"VXGE_OS_STXFMT, (ptr_t) vpath_handle);

    vxge_os_pio_mem_write64(vp->vpath->hldev->header.pdev,
                            vp->vpath->hldev->header.regh0,
                            VXGE_HAL_CMN_RSTHDLR_CFG2_SW_RESET_FIFO0(
                                1 << (16 - vp->vpath->vp_id)),
                            &vp->vpath->hldev->common_reg->cmn_rsthdlr_cfg2);

    vxge_os_wmb();

    status = vxge_hal_device_register_poll(vp->vpath->hldev->header.pdev,
                                           vp->vpath->hldev->header.regh0,
                                           &vp->vpath->hldev->common_reg->cmn_rsthdlr_cfg2, 0,
                                           (u64) VXGE_HAL_CMN_RSTHDLR_CFG2_SW_RESET_FIFO0(
                                                   1 << (16 - vp->vpath->vp_id)),
                                           VXGE_HAL_DEF_DEVICE_POLL_MILLIS);

    vxge_hal_trace_log_fifo("<== %s:%s:%d  Result: 0",
                            __FILE__, __func__, __LINE__);

    return (status);
}
Esempio n. 4
0
/*
 * __hal_ifmsg_wmsg_post - Posts the srpcim to vpath req
 * @hldev: Hal device
 * @src_vp_id: Source vpath id
 * @dest_vp_id: Vpath id, VXGE_HAL_RTS_ACCESS_STEER_MSG_DEST_MRPCIM, or
 *	    VXGE_HAL_RTS_ACCESS_STEER_MSG_DEST_BROADCAST
 * @msg_type: wsmsg type
 * @msg_data: wsmsg data
 *
 * Posts the req
 */
vxge_hal_status_e
__hal_ifmsg_wmsg_post(
    __hal_device_t *hldev,
    u32 src_vp_id,
    u32 dest_vp_id,
    u32 msg_type,
    u32 msg_data)
{
	u64 val64;
	vxge_hal_vpath_reg_t *vp_reg;
	vxge_hal_status_e status;

	vxge_assert(hldev);

	vp_reg = hldev->vpath_reg[src_vp_id];

	vxge_hal_trace_log_vpath("==> %s:%s:%d",
	    __FILE__, __func__, __LINE__);

	vxge_hal_trace_log_srpcim(
	    "hldev = 0x"VXGE_OS_STXFMT", src_vp_id = %d, dest_vp_id = %d, "
	    "msg_type = %d, msg_data = %d", (ptr_t) hldev, src_vp_id,
	    dest_vp_id, msg_type, msg_data);

	vxge_os_pio_mem_write64(hldev->header.pdev,
	    hldev->header.regh0,
	    0,
	    &vp_reg->rts_access_steer_ctrl);

	vxge_os_wmb();


	vxge_os_pio_mem_write64(hldev->header.pdev,
	    hldev->header.regh0,
	    VXGE_HAL_RTS_ACCESS_STEER_DATA0_IGNORE_IN_SVC_CHECK |
	    VXGE_HAL_RTS_ACCESS_STEER_DATA0_MSG_TYPE(msg_type) |
	    VXGE_HAL_RTS_ACCESS_STEER_DATA0_MSG_DEST(dest_vp_id) |
	    VXGE_HAL_RTS_ACCESS_STEER_DATA0_MSG_SRC(src_vp_id) |
	    VXGE_HAL_RTS_ACCESS_STEER_DATA0_SEQ_NUM(++hldev->ifmsg_seqno) |
	    VXGE_HAL_RTS_ACCESS_STEER_DATA0_MSG_DATA(msg_data),
	    &vp_reg->rts_access_steer_data0);

	vxge_os_pio_mem_write64(hldev->header.pdev,
	    hldev->header.regh0,
	    0,
	    &vp_reg->rts_access_steer_data1);

	vxge_os_wmb();

	val64 = VXGE_HAL_RTS_ACCESS_STEER_CTRL_ACTION(
	    VXGE_HAL_RTS_ACCESS_STEER_CTRL_ACTION_SEND_MSG) |
	    VXGE_HAL_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL(
	    VXGE_HAL_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_FW_MEMO) |
	    VXGE_HAL_RTS_ACCESS_STEER_CTRL_STROBE |
	    VXGE_HAL_RTS_ACCESS_STEER_CTRL_OFFSET(0);

	vxge_hal_pio_mem_write32_lower(hldev->header.pdev,
	    hldev->header.regh0,
	    (u32) bVAL32(val64, 32),
	    &vp_reg->rts_access_steer_ctrl);

	vxge_os_wmb();

	vxge_hal_pio_mem_write32_upper(hldev->header.pdev,
	    hldev->header.regh0,
	    (u32) bVAL32(val64, 0),
	    &vp_reg->rts_access_steer_ctrl);

	vxge_os_wmb();

	status = vxge_hal_device_register_poll(hldev->header.pdev,
	    hldev->header.regh0,
	    &vp_reg->rts_access_steer_ctrl, 0,
	    VXGE_HAL_RTS_ACCESS_STEER_CTRL_STROBE,
	    WAIT_FACTOR * hldev->header.config.device_poll_millis);

	if (status != VXGE_HAL_OK) {

		vxge_hal_trace_log_driver("<== %s:%s:%d  Result: %d",
		    __FILE__, __func__, __LINE__, status);
		return (status);
	}

	val64 = vxge_os_pio_mem_read64(hldev->header.pdev,
	    hldev->header.regh0,
	    &vp_reg->rts_access_steer_ctrl);

	if (val64 & VXGE_HAL_RTS_ACCESS_STEER_CTRL_RMACJ_STATUS) {

		vxge_os_pio_mem_read64(hldev->header.pdev,
		    hldev->header.regh0,
		    &vp_reg->rts_access_steer_data0);

		status = VXGE_HAL_OK;

	} else {
		status = VXGE_HAL_FAIL;
	}

	vxge_hal_trace_log_srpcim("<== %s:%s:%d Result = %d",
	    __FILE__, __func__, __LINE__, status);

	return (status);
}
Esempio n. 5
0
/*
 * _hal_legacy_swapper_set - Set the swapper bits for the legacy secion.
 * @pdev: PCI device object.
 * @regh: BAR0 mapped memory handle (Solaris), or simply PCI device @pdev
 *	(Linux and the rest.)
 * @legacy_reg: Address of the legacy register space.
 *
 * Set the swapper bits appropriately for the lagacy section.
 *
 * Returns:  VXGE_HAL_OK - success.
 * VXGE_HAL_ERR_SWAPPER_CTRL - failed.
 *
 * See also: vxge_hal_status_e {}.
 */
vxge_hal_status_e
__hal_legacy_swapper_set(
    pci_dev_h pdev,
    pci_reg_h regh,
    vxge_hal_legacy_reg_t *legacy_reg)
{
	u64 val64;
	vxge_hal_status_e status;

	vxge_assert(legacy_reg != NULL);

	vxge_hal_trace_log_driver("==> %s:%s:%d",
	    __FILE__, __func__, __LINE__);

	vxge_hal_trace_log_driver(
	    "pdev = 0x"VXGE_OS_STXFMT", regh = 0x"VXGE_OS_STXFMT", "
	    "legacy_reg = 0x"VXGE_OS_STXFMT, (ptr_t) pdev, (ptr_t) regh,
	    (ptr_t) legacy_reg);

	val64 = vxge_os_pio_mem_read64(pdev, regh, &legacy_reg->toc_swapper_fb);

	vxge_hal_info_log_driver("TOC Swapper Fb: 0x"VXGE_OS_LLXFMT, val64);

	vxge_os_wmb();

	switch (val64) {

	case VXGE_HAL_SWAPPER_INITIAL_VALUE:
		return (VXGE_HAL_OK);

	case VXGE_HAL_SWAPPER_BYTE_SWAPPED_BIT_FLIPPED:
		vxge_os_pio_mem_write64(pdev, regh,
		    VXGE_HAL_SWAPPER_READ_BYTE_SWAP_ENABLE,
		    &legacy_reg->pifm_rd_swap_en);
		vxge_os_pio_mem_write64(pdev, regh,
		    VXGE_HAL_SWAPPER_READ_BIT_FLAP_ENABLE,
		    &legacy_reg->pifm_rd_flip_en);
		vxge_os_pio_mem_write64(pdev, regh,
		    VXGE_HAL_SWAPPER_WRITE_BYTE_SWAP_ENABLE,
		    &legacy_reg->pifm_wr_swap_en);
		vxge_os_pio_mem_write64(pdev, regh,
		    VXGE_HAL_SWAPPER_WRITE_BIT_FLAP_ENABLE,
		    &legacy_reg->pifm_wr_flip_en);
		break;

	case VXGE_HAL_SWAPPER_BYTE_SWAPPED:
		vxge_os_pio_mem_write64(pdev, regh,
		    VXGE_HAL_SWAPPER_READ_BYTE_SWAP_ENABLE,
		    &legacy_reg->pifm_rd_swap_en);
		vxge_os_pio_mem_write64(pdev, regh,
		    VXGE_HAL_SWAPPER_WRITE_BYTE_SWAP_ENABLE,
		    &legacy_reg->pifm_wr_swap_en);
		break;

	case VXGE_HAL_SWAPPER_BIT_FLIPPED:
		vxge_os_pio_mem_write64(pdev, regh,
		    VXGE_HAL_SWAPPER_READ_BIT_FLAP_ENABLE,
		    &legacy_reg->pifm_rd_flip_en);
		vxge_os_pio_mem_write64(pdev, regh,
		    VXGE_HAL_SWAPPER_WRITE_BIT_FLAP_ENABLE,
		    &legacy_reg->pifm_wr_flip_en);
		break;

	}

	vxge_os_wmb();

	val64 = vxge_os_pio_mem_read64(pdev, regh, &legacy_reg->toc_swapper_fb);

	if (val64 == VXGE_HAL_SWAPPER_INITIAL_VALUE) {
		status = VXGE_HAL_OK;
	} else {
		vxge_hal_err_log_driver("%s:TOC Swapper setting failed",
		    __func__);
		status = VXGE_HAL_ERR_SWAPPER_CTRL;
	}

	vxge_hal_info_log_driver("TOC Swapper Fb: 0x"VXGE_OS_LLXFMT, val64);

	vxge_hal_trace_log_driver("<== %s:%s:%d  Result: %d",
	    __FILE__, __func__, __LINE__, status);

	return (status);
}