FreeBSD/sys/dev/mxge/if_mxge.c
/*
 * Enable or disable periodic RDMAs from the host to make certain
 * chipsets resend dropped PCIe messages
 */
Enable or disable periodic RDMAs from the host to make certain
chipsets resend dropped PCIe messages
Enable or disable periodic RDMAs from the host to make certain chipsets resend dropped PCIe messages
static void
mxge_dummy_rdma(mxge_softc_t *sc, int enable)
{
	char buf_bytes[72];
	volatile uint32_t *confirm;
	volatile char *submit;
	uint32_t *buf, dma_low, dma_high;
	int i;
	buf = (uint32_t *)((unsigned long)(buf_bytes + 7) & ~7UL);
	confirm = (volatile uint32_t *)sc->cmd;
	*confirm = 0;
	wmb();
	dma_low = MXGE_LOWPART_TO_U32(sc->cmd_dma.bus_addr);
	dma_high = MXGE_HIGHPART_TO_U32(sc->cmd_dma.bus_addr);
	buf[0] = htobe32(dma_high);		
	buf[1] = htobe32(dma_low);		
	buf[2] = htobe32(0xffffffff);		
	dma_low = MXGE_LOWPART_TO_U32(sc->zeropad_dma.bus_addr);
	dma_high = MXGE_HIGHPART_TO_U32(sc->zeropad_dma.bus_addr);
	buf[3] = htobe32(dma_high); 		
	buf[4] = htobe32(dma_low); 		
	buf[5] = htobe32(enable);			
	submit = (volatile char *)(sc->sram + MXGEFW_BOOT_DUMMY_RDMA);
	mxge_pio_copy(submit, buf, 64);
	wmb();
	DELAY(1000);
	wmb();
	i = 0;
	while (*confirm != 0xffffffff && i < 20) {
		DELAY(1000);
		i++;
	}
	if (*confirm != 0xffffffff) {
		device_printf(sc->dev, "dummy rdma %s failed (%p = 0x%x)",
			      (enable ? "enable" : "disable"), confirm,
			      *confirm);
	}
	return;
}
static void mxge_dummy_rdma ( mxge_softc_t * sc , int enable ) { char buf_bytes [ 72 ] ; volatile uint32_t * confirm ; volatile char * submit ; uint32_t * buf , dma_low , dma_high ; int i ; buf = ( uint32_t * ) ( ( unsigned long ) ( buf_bytes + 7 ) & ~ 7UL ) ; confirm = ( volatile uint32_t * ) sc -> cmd ; * confirm = 0 ; wmb ( ) ; dma_low = MXGE_LOWPART_TO_U32 ( sc -> cmd_dma . bus_addr ) ; dma_high = MXGE_HIGHPART_TO_U32 ( sc -> cmd_dma . bus_addr ) ; buf [ 0 ] = htobe32 ( dma_high ) ; buf [ 1 ] = htobe32 ( dma_low ) ; buf [ 2 ] = htobe32 ( 0xffffffff ) ; dma_low = MXGE_LOWPART_TO_U32 ( sc -> zeropad_dma . bus_addr ) ; dma_high = MXGE_HIGHPART_TO_U32 ( sc -> zeropad_dma . bus_addr ) ; buf [ 3 ] = htobe32 ( dma_high ) ; buf [ 4 ] = htobe32 ( dma_low ) ; buf [ 5 ] = htobe32 ( enable ) ; submit = ( volatile char * ) ( sc -> sram + MXGEFW_BOOT_DUMMY_RDMA ) ; mxge_pio_copy ( submit , buf , 64 ) ; wmb ( ) ; DELAY ( 1000 ) ; wmb ( ) ; i = 0 ; while ( * confirm != 0xffffffff && i < 20 ) { DELAY ( 1000 ) ; i ++ ; } if ( * confirm != 0xffffffff ) { device_printf ( sc -> dev , " " , ( enable ? " " : " " ) , confirm , * confirm ) ; } return ; }
Enable or disable periodic RDMAs from the host to make certain
 chipsets resend dropped PCIe messages
Enable or disable periodic RDMAs from the host to make certain chipsets resend dropped PCIe messages
/* clear confirmation addr */ /* send an rdma command to the PCIe engine, and wait for the
	   response in the confirmation address.  The firmware should
	   write a -1 there to indicate it is alive and well
	*/ /* confirm addr MSW */ /* confirm addr LSW */ /* confirm data */ /* dummy addr MSW */ /* dummy addr LSW */ /* enable? */