FreeBSD/sys/dev/ips/ips_commands.c
/* Below are a series of functions for sending a drive info request 
 * to the adapter.  The flow order is: get, send, callback. It uses
 * the generic finish callback at the top of this file. 
 * This can be used to get drive status info from the card */
Below are a series of functions for sending a drive info request
to the adapter.  The flow order is: get, send, callback. It uses
the generic finish callback at the top of this file.
This can be used to get drive status info from the card
Below are a series of functions for sending a drive info request to the adapter . The flow order is : get send callback . It uses the generic finish callback at the top of this file . This can be used to get drive status info from the card
static void ips_drive_info_callback(void *cmdptr, bus_dma_segment_t *segments,int segnum, int error)
{
	ips_softc_t *sc;
	ips_command_t *command = cmdptr;
	ips_drive_cmd *command_struct;
	ips_drive_info_t *driveinfo;
	sc = command->sc;
	if(error){
		ips_set_error(command, error);
		printf("ips: error = %d in ips_get_drive_info\n", error);
		return;
	}
	command_struct = (ips_drive_cmd *)command->command_buffer;
	command_struct->command = IPS_DRIVE_INFO_CMD;
	command_struct->id = command->id;
	command_struct->buffaddr = segments[0].ds_addr;
	bus_dmamap_sync(sc->command_dmatag, command->command_dmamap, 
			BUS_DMASYNC_PREWRITE);
	bus_dmamap_sync(command->data_dmatag, command->data_dmamap, 
			BUS_DMASYNC_PREREAD);
	sc->ips_issue_cmd(command);
	if (sema_timedwait(&sc->cmd_sema, 10*hz) != 0) {
		ips_set_error(command, ETIMEDOUT);
		return;
	}
	bus_dmamap_sync(command->data_dmatag, command->data_dmamap, 
			BUS_DMASYNC_POSTREAD);
	driveinfo = command->data_buffer;
	memcpy(sc->drives, driveinfo->drives, sizeof(ips_drive_t) * 8);	
	sc->drivecount = driveinfo->drivecount;
	device_printf(sc->dev, "logical drives: %d\n",sc->drivecount);
}
static void ips_drive_info_callback ( void * cmdptr , bus_dma_segment_t * segments , int segnum , int error ) { ips_softc_t * sc ; ips_command_t * command = cmdptr ; ips_drive_cmd * command_struct ; ips_drive_info_t * driveinfo ; sc = command -> sc ; if ( error ) { ips_set_error ( command , error ) ; printf ( " \n " , error ) ; return ; } command_struct = ( ips_drive_cmd * ) command -> command_buffer ; command_struct -> command = IPS_DRIVE_INFO_CMD ; command_struct -> id = command -> id ; command_struct -> buffaddr = segments [ 0 ] . ds_addr ; bus_dmamap_sync ( sc -> command_dmatag , command -> command_dmamap , BUS_DMASYNC_PREWRITE ) ; bus_dmamap_sync ( command -> data_dmatag , command -> data_dmamap , BUS_DMASYNC_PREREAD ) ; sc -> ips_issue_cmd ( command ) ; if ( sema_timedwait ( & sc -> cmd_sema , 10 * hz ) != 0 ) { ips_set_error ( command , ETIMEDOUT ) ; return ; } bus_dmamap_sync ( command -> data_dmatag , command -> data_dmamap , BUS_DMASYNC_POSTREAD ) ; driveinfo = command -> data_buffer ; memcpy ( sc -> drives , driveinfo -> drives , sizeof ( ips_drive_t ) * 8 ) ; sc -> drivecount = driveinfo -> drivecount ; device_printf ( sc -> dev , " \n " , sc -> drivecount ) ; }
Below are a series of functions for sending a drive info request
 to the adapter.
Below are a series of functions for sending a drive info request to the adapter .