FreeBSD/sys/dev/mrsas/mrsas.c
/*
 * mrsas_get_ld_map_info:      Get FW's ld_map structure input:
 * Adapter instance soft state
 *
 * Issues an internal command (DCMD) to get the FW's controller PD list
 * structure.
 */
Get FW's ld_map structure input:
Adapter instance soft state

Issues an internal command (DCMD) to get the FW's controller PD list
structure.
Get FW ' s ld_map structure input : Adapter instance soft state Issues an internal command ( DCMD ) to get the FW ' s controller PD list structure .
static int
mrsas_get_ld_map_info(struct mrsas_softc *sc)
{
	int retcode = 0;
	struct mrsas_mfi_cmd *cmd;
	struct mrsas_dcmd_frame *dcmd;
	void *map;
	bus_addr_t map_phys_addr = 0;
	cmd = mrsas_get_mfi_cmd(sc);
	if (!cmd) {
		device_printf(sc->mrsas_dev,
		    "Cannot alloc for ld map info cmd.\n");
		return 1;
	}
	dcmd = &cmd->frame->dcmd;
	map = (void *)sc->raidmap_mem[(sc->map_id & 1)];
	map_phys_addr = sc->raidmap_phys_addr[(sc->map_id & 1)];
	if (!map) {
		device_printf(sc->mrsas_dev,
		    "Failed to alloc mem for ld map info.\n");
		mrsas_release_mfi_cmd(cmd);
		return (ENOMEM);
	}
	memset(map, 0, sizeof(sc->max_map_sz));
	memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
	dcmd->cmd = MFI_CMD_DCMD;
	dcmd->cmd_status = 0xFF;
	dcmd->sge_count = 1;
	dcmd->flags = MFI_FRAME_DIR_READ;
	dcmd->timeout = 0;
	dcmd->pad_0 = 0;
	dcmd->data_xfer_len = sc->current_map_sz;
	dcmd->opcode = MR_DCMD_LD_MAP_GET_INFO;
	dcmd->sgl.sge32[0].phys_addr = map_phys_addr;
	dcmd->sgl.sge32[0].length = sc->current_map_sz;
	retcode = mrsas_issue_polled(sc, cmd);
	if (retcode == ETIMEDOUT)
		sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR;
	else
		mrsas_release_mfi_cmd(cmd);
	return (retcode);
}
static int mrsas_get_ld_map_info ( struct mrsas_softc * sc ) { int retcode = 0 ; struct mrsas_mfi_cmd * cmd ; struct mrsas_dcmd_frame * dcmd ; void * map ; bus_addr_t map_phys_addr = 0 ; cmd = mrsas_get_mfi_cmd ( sc ) ; if ( ! cmd ) { device_printf ( sc -> mrsas_dev , " \n " ) ; return 1 ; } dcmd = & cmd -> frame -> dcmd ; map = ( void * ) sc -> raidmap_mem [ ( sc -> map_id & 1 ) ] ; map_phys_addr = sc -> raidmap_phys_addr [ ( sc -> map_id & 1 ) ] ; if ( ! map ) { device_printf ( sc -> mrsas_dev , " \n " ) ; mrsas_release_mfi_cmd ( cmd ) ; return ( ENOMEM ) ; } memset ( map , 0 , sizeof ( sc -> max_map_sz ) ) ; memset ( dcmd -> mbox . b , 0 , MFI_MBOX_SIZE ) ; dcmd -> cmd = MFI_CMD_DCMD ; dcmd -> cmd_status = 0xFF ; dcmd -> sge_count = 1 ; dcmd -> flags = MFI_FRAME_DIR_READ ; dcmd -> timeout = 0 ; dcmd -> pad_0 = 0 ; dcmd -> data_xfer_len = sc -> current_map_sz ; dcmd -> opcode = MR_DCMD_LD_MAP_GET_INFO ; dcmd -> sgl . sge32 [ 0 ] . phys_addr = map_phys_addr ; dcmd -> sgl . sge32 [ 0 ] . length = sc -> current_map_sz ; retcode = mrsas_issue_polled ( sc , cmd ) ; if ( retcode == ETIMEDOUT ) sc -> do_timedout_reset = MFI_DCMD_TIMEOUT_OCR ; else mrsas_release_mfi_cmd ( cmd ) ; return ( retcode ) ; }
mrsas_get_ld_map_info:      Get FW's ld_map structure input:
 Adapter instance soft state
mrsas_get_ld_map_info : Get FW ' s ld_map structure input : Adapter instance soft state