FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	t3_check_tpsram - check if provided protocol SRAM
 *			  is compatible with this driver
 *	@adapter: the adapter
 *	@tp_sram: the firmware image to write
 *	@size: image size
 *
 *	Checks if an adapter's tp sram is compatible with the driver.
 *	Returns 0 if the versions are compatible, a negative error otherwise.
 */
check if provided protocol SRAM
is compatible with this driver
@adapter: the adapter
@tp_sram: the firmware image to write
@size: image size

Checks if an adapter's tp sram is compatible with the driver.
Returns 0 if the versions are compatible, a negative error otherwise.
check if provided protocol SRAM is compatible with this driver @adapter : the adapter @tp_sram : the firmware image to write @size : image size Checks if an adapter ' s tp sram is compatible with the driver . Returns 0 if the versions are compatible a negative error otherwise .
int t3_check_tpsram(adapter_t *adapter, const u8 *tp_sram, unsigned int size)
{
	u32 csum;
	unsigned int i;
	const u32 *p = (const u32 *)tp_sram;
	for (csum = 0, i = 0; i < size / sizeof(csum); i++)
		csum += ntohl(p[i]);
	if (csum != 0xffffffff) {
		CH_ERR(adapter, "corrupted protocol SRAM image, checksum %u\n",
		       csum);
		return -EINVAL;
	}
	return 0;
}
int t3_check_tpsram ( adapter_t * adapter , const u8 * tp_sram , unsigned int size ) { u32 csum ; unsigned int i ; const u32 * p = ( const u32 * ) tp_sram ; for ( csum = 0 , i = 0 ; i < size / sizeof ( csum ) ; i ++ ) csum += ntohl ( p [ i ] ) ; if ( csum != 0xffffffff ) { CH_ERR ( adapter , " \n " , csum ) ; return - EINVAL ; } return 0 ; }
t3_check_tpsram - check if provided protocol SRAM
                        is compatible with this driver
      @adapter: the adapter
      @tp_sram: the firmware image to write
      @size: image size
t3_check_tpsram - check if provided protocol SRAM is compatible with this driver @adapter : the adapter @tp_sram : the firmware image to write @size : image size
/* Verify checksum */