FreeBSD/sys/dev/mrsas/mrsas.c
/*
 * mrsas_alloc_ctlr_info_cmd:	Allocates memory for controller info command
 * input:						Adapter soft state
 *
 * Allocates DMAable memory for the controller info internal command.
 */
Allocates memory for controller info command
input:                                               Adapter soft state

Allocates DMAable memory for the controller info internal command.
Allocates memory for controller info command input : Adapter soft state Allocates DMAable memory for the controller info internal command .
int
mrsas_alloc_ctlr_info_cmd(struct mrsas_softc *sc)
{
	int ctlr_info_size;
	ctlr_info_size = sizeof(struct mrsas_ctrl_info);
	if (bus_dma_tag_create(sc->mrsas_parent_tag,
	    1, 0,
	    BUS_SPACE_MAXADDR_32BIT,
	    BUS_SPACE_MAXADDR,
	    NULL, NULL,
	    ctlr_info_size,
	    1,
	    ctlr_info_size,
	    BUS_DMA_ALLOCNOW,
	    NULL, NULL,
	    &sc->ctlr_info_tag)) {
		device_printf(sc->mrsas_dev, "Cannot allocate ctlr info tag\n");
		return (ENOMEM);
	}
	if (bus_dmamem_alloc(sc->ctlr_info_tag, (void **)&sc->ctlr_info_mem,
	    BUS_DMA_NOWAIT, &sc->ctlr_info_dmamap)) {
		device_printf(sc->mrsas_dev, "Cannot allocate ctlr info cmd mem\n");
		return (ENOMEM);
	}
	if (bus_dmamap_load(sc->ctlr_info_tag, sc->ctlr_info_dmamap,
	    sc->ctlr_info_mem, ctlr_info_size, mrsas_addr_cb,
	    &sc->ctlr_info_phys_addr, BUS_DMA_NOWAIT)) {
		device_printf(sc->mrsas_dev, "Cannot load ctlr info cmd mem\n");
		return (ENOMEM);
	}
	memset(sc->ctlr_info_mem, 0, ctlr_info_size);
	return (0);
}
int mrsas_alloc_ctlr_info_cmd ( struct mrsas_softc * sc ) { int ctlr_info_size ; ctlr_info_size = sizeof ( struct mrsas_ctrl_info ) ; if ( bus_dma_tag_create ( sc -> mrsas_parent_tag , 1 , 0 , BUS_SPACE_MAXADDR_32BIT , BUS_SPACE_MAXADDR , NULL , NULL , ctlr_info_size , 1 , ctlr_info_size , BUS_DMA_ALLOCNOW , NULL , NULL , & sc -> ctlr_info_tag ) ) { device_printf ( sc -> mrsas_dev , " \n " ) ; return ( ENOMEM ) ; } if ( bus_dmamem_alloc ( sc -> ctlr_info_tag , ( void * * ) & sc -> ctlr_info_mem , BUS_DMA_NOWAIT , & sc -> ctlr_info_dmamap ) ) { device_printf ( sc -> mrsas_dev , " \n " ) ; return ( ENOMEM ) ; } if ( bus_dmamap_load ( sc -> ctlr_info_tag , sc -> ctlr_info_dmamap , sc -> ctlr_info_mem , ctlr_info_size , mrsas_addr_cb , & sc -> ctlr_info_phys_addr , BUS_DMA_NOWAIT ) ) { device_printf ( sc -> mrsas_dev , " \n " ) ; return ( ENOMEM ) ; } memset ( sc -> ctlr_info_mem , 0 , ctlr_info_size ) ; return ( 0 ) ; }
mrsas_alloc_ctlr_info_cmd:   Allocates memory for controller info command
 input:                                               Adapter soft state
mrsas_alloc_ctlr_info_cmd : Allocates memory for controller info command input : Adapter soft state
/* Allocate get controller info command */