FreeBSD/sys/dev/nxge/xgehal/xgehal-device.c
/**
 * xge_hal_channel_msi_set - Associate a RTI with a ring or TTI with a
 * FIFO for a given MSI.
 * @channelh: HAL channel handle.
 * @msi: MSI Number associated with the channel.
 * @msi_msg: The MSI message associated with the MSI number above.
 *
 * This API will associate a given channel (either Ring or FIFO) with the
 * given MSI number. It will alo program the Tx_Mat/Rx_Mat tables in the
 * hardware to indicate this association to the hardware.
 */
Associate a RTI with a ring or TTI with a
FIFO for a given MSI.
@channelh: HAL channel handle.
@msi: MSI Number associated with the channel.
@msi_msg: The MSI message associated with the MSI number above.

This API will associate a given channel (either Ring or FIFO) with the
given MSI number. It will alo program the Tx_Mat/Rx_Mat tables in the
hardware to indicate this association to the hardware.
Associate a RTI with a ring or TTI with a FIFO for a given MSI . @channelh : HAL channel handle . @msi : MSI Number associated with the channel . @msi_msg : The MSI message associated with the MSI number above . This API will associate a given channel ( either Ring or FIFO ) with the given MSI number . It will alo program the Tx_Mat / Rx_Mat tables in the hardware to indicate this association to the hardware .
xge_hal_status_e
xge_hal_channel_msi_set(xge_hal_channel_h channelh, int msi, u32 msi_msg)
{
	xge_hal_channel_t *channel = (xge_hal_channel_t *)channelh;
	xge_hal_device_t *hldev = (xge_hal_device_t*)channel->devh;
	xge_hal_pci_bar0_t *bar0 = (xge_hal_pci_bar0_t *)hldev->bar0;
	u64 val64;
	channel->msi_msg = msi_msg;
	if (channel->type == XGE_HAL_CHANNEL_TYPE_RING) {
	    int ring = channel->post_qid;
	    xge_debug_osdep(XGE_TRACE, "MSI Data: 0x%4x, Ring: %d,"
	            " MSI: %d", channel->msi_msg, ring, msi);
	    val64 = xge_os_pio_mem_read64(hldev->pdev, hldev->regh0,
	        &bar0->rx_mat);
	    val64 |= XGE_HAL_SET_RX_MAT(ring, msi);
	    xge_os_pio_mem_write64(hldev->pdev, hldev->regh0, val64,
	        &bar0->rx_mat);
	    __hal_device_rti_set(ring, channel);
	} else {
	    int fifo = channel->post_qid;
	    xge_debug_osdep(XGE_TRACE, "MSI Data: 0x%4x, Fifo: %d,"
	            " MSI: %d", channel->msi_msg, fifo, msi);
	    val64 = xge_os_pio_mem_read64(hldev->pdev, hldev->regh0,
	        &bar0->tx_mat[0]);
	    val64 |= XGE_HAL_SET_TX_MAT(fifo, msi);
	    xge_os_pio_mem_write64(hldev->pdev, hldev->regh0, val64,
	        &bar0->tx_mat[0]);
	    __hal_device_tti_set(fifo, channel);
	}
	 return XGE_HAL_OK;
}
xge_hal_status_e xge_hal_channel_msi_set ( xge_hal_channel_h channelh , int msi , u32 msi_msg ) { xge_hal_channel_t * channel = ( xge_hal_channel_t * ) channelh ; xge_hal_device_t * hldev = ( xge_hal_device_t * ) channel -> devh ; xge_hal_pci_bar0_t * bar0 = ( xge_hal_pci_bar0_t * ) hldev -> bar0 ; u64 val64 ; channel -> msi_msg = msi_msg ; if ( channel -> type == XGE_HAL_CHANNEL_TYPE_RING ) { int ring = channel -> post_qid ; xge_debug_osdep ( XGE_TRACE , " " " " , channel -> msi_msg , ring , msi ) ; val64 = xge_os_pio_mem_read64 ( hldev -> pdev , hldev -> regh0 , & bar0 -> rx_mat ) ; val64 |= XGE_HAL_SET_RX_MAT ( ring , msi ) ; xge_os_pio_mem_write64 ( hldev -> pdev , hldev -> regh0 , val64 , & bar0 -> rx_mat ) ; __hal_device_rti_set ( ring , channel ) ; } else { int fifo = channel -> post_qid ; xge_debug_osdep ( XGE_TRACE , " " " " , channel -> msi_msg , fifo , msi ) ; val64 = xge_os_pio_mem_read64 ( hldev -> pdev , hldev -> regh0 , & bar0 -> tx_mat [ 0 ] ) ; val64 |= XGE_HAL_SET_TX_MAT ( fifo , msi ) ; xge_os_pio_mem_write64 ( hldev -> pdev , hldev -> regh0 , val64 , & bar0 -> tx_mat [ 0 ] ) ; __hal_device_tti_set ( fifo , channel ) ; } return XGE_HAL_OK ; }
xge_hal_channel_msi_set - Associate a RTI with a ring or TTI with a
 FIFO for a given MSI.
xge_hal_channel_msi_set - Associate a RTI with a ring or TTI with a FIFO for a given MSI .