FreeBSD/sys/dev/nxge/xgehal/xgehal-mgmt.c
/**
 * xge_hal_restore_link_led - Restore link LED to its original state.
 * @devh: HAL device handle.
 */
Restore link LED to its original state.
@devh: HAL device handle.
Restore link LED to its original state . @devh : HAL device handle .
void
xge_hal_restore_link_led(xge_hal_device_h devh)
{
	xge_hal_device_t *hldev = (xge_hal_device_t*)devh;
	xge_hal_pci_bar0_t *bar0 = (xge_hal_pci_bar0_t *)hldev->bar0;
	u64 val64;
	if ((xge_hal_device_check_id(hldev) == XGE_HAL_CARD_XENA) &&
	   (xge_hal_device_rev(hldev) <= 3)) {
	    val64 = xge_os_pio_mem_read64(hldev->pdev, hldev->regh0,
	                      &bar0->adapter_control);
	    if (hldev->link_state == XGE_HAL_LINK_UP) {
	        val64 |= XGE_HAL_ADAPTER_LED_ON;
	    } else {
	        val64 &= ~XGE_HAL_ADAPTER_LED_ON;
	    }
	    xge_os_pio_mem_write64(hldev->pdev, hldev->regh0, val64,
	                &bar0->adapter_control);
	    return;
	}
	val64 = xge_os_pio_mem_read64(hldev->pdev, hldev->regh0,
	                  &bar0->beacon_control);
	val64 |= 0x0000800000000000ULL;
	xge_os_pio_mem_write64(hldev->pdev, hldev->regh0,
	               val64, &bar0->beacon_control);
}
void xge_hal_restore_link_led ( xge_hal_device_h devh ) { xge_hal_device_t * hldev = ( xge_hal_device_t * ) devh ; xge_hal_pci_bar0_t * bar0 = ( xge_hal_pci_bar0_t * ) hldev -> bar0 ; u64 val64 ; if ( ( xge_hal_device_check_id ( hldev ) == XGE_HAL_CARD_XENA ) && ( xge_hal_device_rev ( hldev ) <= 3 ) ) { val64 = xge_os_pio_mem_read64 ( hldev -> pdev , hldev -> regh0 , & bar0 -> adapter_control ) ; if ( hldev -> link_state == XGE_HAL_LINK_UP ) { val64 |= XGE_HAL_ADAPTER_LED_ON ; } else { val64 &= ~ XGE_HAL_ADAPTER_LED_ON ; } xge_os_pio_mem_write64 ( hldev -> pdev , hldev -> regh0 , val64 , & bar0 -> adapter_control ) ; return ; } val64 = xge_os_pio_mem_read64 ( hldev -> pdev , hldev -> regh0 , & bar0 -> beacon_control ) ; val64 |= 0x0000800000000000ULL ; xge_os_pio_mem_write64 ( hldev -> pdev , hldev -> regh0 , val64 , & bar0 -> beacon_control ) ; }
xge_hal_restore_link_led - Restore link LED to its original state.
xge_hal_restore_link_led - Restore link LED to its original state .
/*
	 * If the current link state is UP, switch on LED else make it
	 * off.
	 */ /*
	 * For Xena 3 and lower revision cards, adapter control needs to be
	 * used for making LED ON/OFF.
	 */ /*
	 * Use beacon control register to control the LED.
	 * LED link output corresponds to bit 8 of the beacon control
	 * register. Note that, in the case of Xena, beacon control register
	 * represents the gpio control register. In the case of Herc, LED
	 * handling is done by beacon control register as opposed to gpio
	 * control register in Xena. Beacon control is used only to toggle
	 * and the value written into it does not depend on the link state.
	 * It is upto the ULD to toggle the LED even number of times which 
	 * brings the LED to it's original state. 
	 */