FreeBSD/sys/dev/mrsas/mrsas.c
/*
 * mrsas_alloc_tmp_dcmd:       Allocates memory for temporary command input:
 * Adapter soft state Temp command Size of alloction
 *
 * Allocates DMAable memory for a temporary internal command. The allocated
 * memory is initialized to all zeros upon successful loading of the dma
 * mapped memory.
 */
Allocates memory for temporary command input:
Adapter soft state Temp command Size of alloction

Allocates DMAable memory for a temporary internal command. The allocated
memory is initialized to all zeros upon successful loading of the dma
mapped memory.
Allocates memory for temporary command input : Adapter soft state Temp command Size of alloction Allocates DMAable memory for a temporary internal command . The allocated memory is initialized to all zeros upon successful loading of the dma mapped memory .
int
mrsas_alloc_tmp_dcmd(struct mrsas_softc *sc,
    struct mrsas_tmp_dcmd *tcmd, int size)
{
	if (bus_dma_tag_create(sc->mrsas_parent_tag,
	    1, 0,
	    BUS_SPACE_MAXADDR_32BIT,
	    BUS_SPACE_MAXADDR,
	    NULL, NULL,
	    size,
	    1,
	    size,
	    BUS_DMA_ALLOCNOW,
	    NULL, NULL,
	    &tcmd->tmp_dcmd_tag)) {
		device_printf(sc->mrsas_dev, "Cannot allocate tmp dcmd tag\n");
		return (ENOMEM);
	}
	if (bus_dmamem_alloc(tcmd->tmp_dcmd_tag, (void **)&tcmd->tmp_dcmd_mem,
	    BUS_DMA_NOWAIT, &tcmd->tmp_dcmd_dmamap)) {
		device_printf(sc->mrsas_dev, "Cannot allocate tmp dcmd mem\n");
		return (ENOMEM);
	}
	if (bus_dmamap_load(tcmd->tmp_dcmd_tag, tcmd->tmp_dcmd_dmamap,
	    tcmd->tmp_dcmd_mem, size, mrsas_addr_cb,
	    &tcmd->tmp_dcmd_phys_addr, BUS_DMA_NOWAIT)) {
		device_printf(sc->mrsas_dev, "Cannot load tmp dcmd mem\n");
		return (ENOMEM);
	}
	memset(tcmd->tmp_dcmd_mem, 0, size);
	return (0);
}
int mrsas_alloc_tmp_dcmd ( struct mrsas_softc * sc , struct mrsas_tmp_dcmd * tcmd , int size ) { if ( bus_dma_tag_create ( sc -> mrsas_parent_tag , 1 , 0 , BUS_SPACE_MAXADDR_32BIT , BUS_SPACE_MAXADDR , NULL , NULL , size , 1 , size , BUS_DMA_ALLOCNOW , NULL , NULL , & tcmd -> tmp_dcmd_tag ) ) { device_printf ( sc -> mrsas_dev , " \n " ) ; return ( ENOMEM ) ; } if ( bus_dmamem_alloc ( tcmd -> tmp_dcmd_tag , ( void * * ) & tcmd -> tmp_dcmd_mem , BUS_DMA_NOWAIT , & tcmd -> tmp_dcmd_dmamap ) ) { device_printf ( sc -> mrsas_dev , " \n " ) ; return ( ENOMEM ) ; } if ( bus_dmamap_load ( tcmd -> tmp_dcmd_tag , tcmd -> tmp_dcmd_dmamap , tcmd -> tmp_dcmd_mem , size , mrsas_addr_cb , & tcmd -> tmp_dcmd_phys_addr , BUS_DMA_NOWAIT ) ) { device_printf ( sc -> mrsas_dev , " \n " ) ; return ( ENOMEM ) ; } memset ( tcmd -> tmp_dcmd_mem , 0 , size ) ; return ( 0 ) ; }
mrsas_alloc_tmp_dcmd:       Allocates memory for temporary command input:
 Adapter soft state Temp command Size of alloction
mrsas_alloc_tmp_dcmd : Allocates memory for temporary command input : Adapter soft state Temp command Size of alloction