Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mrsas/mrsas_cam.c
Show First 20 Lines • Show All 617 Lines • ▼ Show 20 Lines | if (sc->secure_jbod_support && | ||||
mrsas_release_mpt_cmd(cmd); | mrsas_release_mpt_cmd(cmd); | ||||
return (1); | return (1); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
mtx_unlock(&sc->raidmap_lock); | mtx_unlock(&sc->raidmap_lock); | ||||
if (cmd->flags == MRSAS_DIR_IN) /* from device */ | if (cmd->flags == MRSAS_DIR_IN) /* from device */ | ||||
cmd->io_request->Control |= MPI2_SCSIIO_CONTROL_READ; | cmd->io_request->Control |= htole32(MPI2_SCSIIO_CONTROL_READ); | ||||
else if (cmd->flags == MRSAS_DIR_OUT) /* to device */ | else if (cmd->flags == MRSAS_DIR_OUT) /* to device */ | ||||
cmd->io_request->Control |= MPI2_SCSIIO_CONTROL_WRITE; | cmd->io_request->Control |= htole32(MPI2_SCSIIO_CONTROL_WRITE); | ||||
cmd->io_request->SGLFlags = MPI2_SGE_FLAGS_64_BIT_ADDRESSING; | cmd->io_request->SGLFlags = htole16(MPI2_SGE_FLAGS_64_BIT_ADDRESSING); | ||||
cmd->io_request->SGLOffset0 = offsetof(MRSAS_RAID_SCSI_IO_REQUEST, SGL) / 4; | cmd->io_request->SGLOffset0 = offsetof(MRSAS_RAID_SCSI_IO_REQUEST, SGL) / 4; | ||||
cmd->io_request->SenseBufferLowAddress = cmd->sense_phys_addr; | cmd->io_request->SenseBufferLowAddress = htole32(cmd->sense_phys_addr & 0xFFFFFFFF); | ||||
cmd->io_request->SenseBufferLength = MRSAS_SCSI_SENSE_BUFFERSIZE; | cmd->io_request->SenseBufferLength = MRSAS_SCSI_SENSE_BUFFERSIZE; | ||||
req_desc = cmd->request_desc; | req_desc = cmd->request_desc; | ||||
req_desc->SCSIIO.SMID = cmd->index; | req_desc->SCSIIO.SMID = htole16(cmd->index); | ||||
/* | /* | ||||
* Start timer for IO timeout. Default timeout value is 90 second. | * Start timer for IO timeout. Default timeout value is 90 second. | ||||
*/ | */ | ||||
cmd->callout_owner = true; | cmd->callout_owner = true; | ||||
#if (__FreeBSD_version >= 1000510) | #if (__FreeBSD_version >= 1000510) | ||||
callout_reset_sbt(&cmd->cm_callout, SBT_1S * 180, 0, | callout_reset_sbt(&cmd->cm_callout, SBT_1S * 180, 0, | ||||
mrsas_scsiio_timeout, cmd, 0); | mrsas_scsiio_timeout, cmd, 0); | ||||
▲ Show 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | mrsas_prepare_secondRaid1_IO(struct mrsas_softc *sc, | ||||
* command | * command | ||||
*/ | */ | ||||
memcpy(r1_cmd->io_request, cmd->io_request, | memcpy(r1_cmd->io_request, cmd->io_request, | ||||
(sizeof(MRSAS_RAID_SCSI_IO_REQUEST))); | (sizeof(MRSAS_RAID_SCSI_IO_REQUEST))); | ||||
memcpy(&r1_cmd->io_request->SGL, &cmd->io_request->SGL, | memcpy(&r1_cmd->io_request->SGL, &cmd->io_request->SGL, | ||||
(sc->max_sge_in_main_msg * sizeof(MPI2_SGE_IO_UNION))); | (sc->max_sge_in_main_msg * sizeof(MPI2_SGE_IO_UNION))); | ||||
/* sense buffer is different for r1 command */ | /* sense buffer is different for r1 command */ | ||||
r1_cmd->io_request->SenseBufferLowAddress = r1_cmd->sense_phys_addr; | r1_cmd->io_request->SenseBufferLowAddress = htole32(r1_cmd->sense_phys_addr & 0xFFFFFFFF); | ||||
r1_cmd->ccb_ptr = cmd->ccb_ptr; | r1_cmd->ccb_ptr = cmd->ccb_ptr; | ||||
req_desc2 = mrsas_get_request_desc(sc, r1_cmd->index - 1); | req_desc2 = mrsas_get_request_desc(sc, r1_cmd->index - 1); | ||||
req_desc2->addr.Words = 0; | req_desc2->addr.Words = 0; | ||||
r1_cmd->request_desc = req_desc2; | r1_cmd->request_desc = req_desc2; | ||||
req_desc2->SCSIIO.SMID = r1_cmd->index; | req_desc2->SCSIIO.SMID = r1_cmd->index; | ||||
req_desc2->SCSIIO.RequestFlags = req_desc->SCSIIO.RequestFlags; | req_desc2->SCSIIO.RequestFlags = req_desc->SCSIIO.RequestFlags; | ||||
r1_cmd->request_desc->SCSIIO.DevHandle = cmd->r1_alt_dev_handle; | r1_cmd->request_desc->SCSIIO.DevHandle = cmd->r1_alt_dev_handle; | ||||
Show All 30 Lines | mrsas_build_ldio_rw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, | ||||
struct ccb_hdr *ccb_h = &(ccb->ccb_h); | struct ccb_hdr *ccb_h = &(ccb->ccb_h); | ||||
struct ccb_scsiio *csio = &(ccb->csio); | struct ccb_scsiio *csio = &(ccb->csio); | ||||
u_int32_t device_id; | u_int32_t device_id; | ||||
MRSAS_RAID_SCSI_IO_REQUEST *io_request; | MRSAS_RAID_SCSI_IO_REQUEST *io_request; | ||||
device_id = ccb_h->target_id; | device_id = ccb_h->target_id; | ||||
io_request = cmd->io_request; | io_request = cmd->io_request; | ||||
io_request->RaidContext.raid_context.VirtualDiskTgtId = device_id; | io_request->RaidContext.raid_context.VirtualDiskTgtId = htole16(device_id); | ||||
io_request->RaidContext.raid_context.status = 0; | io_request->RaidContext.raid_context.status = 0; | ||||
io_request->RaidContext.raid_context.exStatus = 0; | io_request->RaidContext.raid_context.exStatus = 0; | ||||
/* just the cdb len, other flags zero, and ORed-in later for FP */ | /* just the cdb len, other flags zero, and ORed-in later for FP */ | ||||
io_request->IoFlags = csio->cdb_len; | io_request->IoFlags = htole16(csio->cdb_len); | ||||
if (mrsas_setup_io(sc, cmd, ccb, device_id, io_request) != SUCCESS) | if (mrsas_setup_io(sc, cmd, ccb, device_id, io_request) != SUCCESS) | ||||
device_printf(sc->mrsas_dev, "Build ldio or fpio error\n"); | device_printf(sc->mrsas_dev, "Build ldio or fpio error\n"); | ||||
io_request->DataLength = cmd->length; | io_request->DataLength = htole32(cmd->length); | ||||
if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { | if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { | ||||
if (cmd->sge_count > sc->max_num_sge) { | if (cmd->sge_count > sc->max_num_sge) { | ||||
device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" | device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" | ||||
"max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); | "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); | ||||
return (FAIL); | return (FAIL); | ||||
} | } | ||||
if (sc->is_ventura || sc->is_aero) | if (sc->is_ventura || sc->is_aero) | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | mrsas_setup_io(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd, | ||||
MR_DRV_RAID_MAP_ALL *map_ptr; | MR_DRV_RAID_MAP_ALL *map_ptr; | ||||
struct mrsas_mpt_cmd *r1_cmd = NULL; | struct mrsas_mpt_cmd *r1_cmd = NULL; | ||||
MR_LD_RAID *raid; | MR_LD_RAID *raid; | ||||
u_int8_t fp_possible; | u_int8_t fp_possible; | ||||
u_int32_t start_lba_hi, start_lba_lo, ld_block_size, ld; | u_int32_t start_lba_hi, start_lba_lo, ld_block_size, ld; | ||||
u_int32_t datalength = 0; | u_int32_t datalength = 0; | ||||
io_request->RaidContext.raid_context.VirtualDiskTgtId = device_id; | io_request->RaidContext.raid_context.VirtualDiskTgtId = htole16(device_id); | ||||
start_lba_lo = 0; | start_lba_lo = 0; | ||||
start_lba_hi = 0; | start_lba_hi = 0; | ||||
fp_possible = 0; | fp_possible = 0; | ||||
/* | /* | ||||
* READ_6 (0x08) or WRITE_6 (0x0A) cdb | * READ_6 (0x08) or WRITE_6 (0x0A) cdb | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | start_lba_hi = ((u_int32_t)csio->cdb_io.cdb_bytes[2] << 24) | | ||||
((u_int32_t)csio->cdb_io.cdb_bytes[5]); | ((u_int32_t)csio->cdb_io.cdb_bytes[5]); | ||||
} | } | ||||
memset(&io_info, 0, sizeof(struct IO_REQUEST_INFO)); | memset(&io_info, 0, sizeof(struct IO_REQUEST_INFO)); | ||||
io_info.ldStartBlock = ((u_int64_t)start_lba_hi << 32) | start_lba_lo; | io_info.ldStartBlock = ((u_int64_t)start_lba_hi << 32) | start_lba_lo; | ||||
io_info.numBlocks = datalength; | io_info.numBlocks = datalength; | ||||
io_info.ldTgtId = device_id; | io_info.ldTgtId = device_id; | ||||
io_info.r1_alt_dev_handle = MR_DEVHANDLE_INVALID; | io_info.r1_alt_dev_handle = MR_DEVHANDLE_INVALID; | ||||
io_request->DataLength = cmd->length; | io_request->DataLength = htole32(cmd->length); | ||||
switch (ccb_h->flags & CAM_DIR_MASK) { | switch (ccb_h->flags & CAM_DIR_MASK) { | ||||
case CAM_DIR_IN: | case CAM_DIR_IN: | ||||
io_info.isRead = 1; | io_info.isRead = 1; | ||||
break; | break; | ||||
case CAM_DIR_OUT: | case CAM_DIR_OUT: | ||||
io_info.isRead = 0; | io_info.isRead = 0; | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | cmd->request_desc->SCSIIO.RequestFlags = | ||||
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | ||||
if (sc->mrsas_gen3_ctrl) { | if (sc->mrsas_gen3_ctrl) { | ||||
if (io_request->RaidContext.raid_context.regLockFlags == REGION_TYPE_UNUSED) | if (io_request->RaidContext.raid_context.regLockFlags == REGION_TYPE_UNUSED) | ||||
cmd->request_desc->SCSIIO.RequestFlags = | cmd->request_desc->SCSIIO.RequestFlags = | ||||
(MRSAS_REQ_DESCRIPT_FLAGS_NO_LOCK << | (MRSAS_REQ_DESCRIPT_FLAGS_NO_LOCK << | ||||
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | ||||
io_request->RaidContext.raid_context.Type = MPI2_TYPE_CUDA; | io_request->RaidContext.raid_context.Type = MPI2_TYPE_CUDA; | ||||
io_request->RaidContext.raid_context.nseg = 0x1; | io_request->RaidContext.raid_context.nseg = 0x1; | ||||
io_request->IoFlags |= MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH; | io_request->IoFlags |= htole16(MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH); | ||||
io_request->RaidContext.raid_context.regLockFlags |= | io_request->RaidContext.raid_context.regLockFlags |= | ||||
(MR_RL_FLAGS_GRANT_DESTINATION_CUDA | | (MR_RL_FLAGS_GRANT_DESTINATION_CUDA | | ||||
MR_RL_FLAGS_SEQ_NUM_ENABLE); | MR_RL_FLAGS_SEQ_NUM_ENABLE); | ||||
} else if (sc->is_ventura || sc->is_aero) { | } else if (sc->is_ventura || sc->is_aero) { | ||||
io_request->RaidContext.raid_context_g35.Type = MPI2_TYPE_CUDA; | io_request->RaidContext.raid_context_g35.Type = MPI2_TYPE_CUDA; | ||||
io_request->RaidContext.raid_context_g35.nseg = 0x1; | io_request->RaidContext.raid_context_g35.nseg = 0x1; | ||||
io_request->RaidContext.raid_context_g35.routingFlags.bits.sqn = 1; | io_request->RaidContext.raid_context_g35.routingFlags.bits.sqn = 1; | ||||
io_request->IoFlags |= MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH; | io_request->IoFlags |= htole16(MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH); | ||||
if (io_request->RaidContext.raid_context_g35.routingFlags.bits.sld) { | if (io_request->RaidContext.raid_context_g35.routingFlags.bits.sld) { | ||||
io_request->RaidContext.raid_context_g35.RAIDFlags = | io_request->RaidContext.raid_context_g35.RAIDFlags = | ||||
(MR_RAID_FLAGS_IO_SUB_TYPE_CACHE_BYPASS | (MR_RAID_FLAGS_IO_SUB_TYPE_CACHE_BYPASS | ||||
<< MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT); | << MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT); | ||||
} | } | ||||
} | } | ||||
if ((sc->load_balance_info[device_id].loadBalanceFlag) && | if ((sc->load_balance_info[device_id].loadBalanceFlag) && | ||||
(io_info.isRead)) { | (io_info.isRead)) { | ||||
Show All 14 Lines | if (fp_possible) { | ||||
else | else | ||||
cmd->r1_alt_dev_handle = MR_DEVHANDLE_INVALID; | cmd->r1_alt_dev_handle = MR_DEVHANDLE_INVALID; | ||||
cmd->request_desc->SCSIIO.DevHandle = io_info.devHandle; | cmd->request_desc->SCSIIO.DevHandle = io_info.devHandle; | ||||
io_request->DevHandle = io_info.devHandle; | io_request->DevHandle = io_info.devHandle; | ||||
cmd->pdInterface = io_info.pdInterface; | cmd->pdInterface = io_info.pdInterface; | ||||
} else { | } else { | ||||
/* Not FP IO */ | /* Not FP IO */ | ||||
io_request->RaidContext.raid_context.timeoutValue = map_ptr->raidMap.fpPdIoTimeoutSec; | io_request->RaidContext.raid_context.timeoutValue = htole16(map_ptr->raidMap.fpPdIoTimeoutSec); | ||||
cmd->request_desc->SCSIIO.RequestFlags = | cmd->request_desc->SCSIIO.RequestFlags = | ||||
(MRSAS_REQ_DESCRIPT_FLAGS_LD_IO << | (MRSAS_REQ_DESCRIPT_FLAGS_LD_IO << | ||||
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | ||||
if (sc->mrsas_gen3_ctrl) { | if (sc->mrsas_gen3_ctrl) { | ||||
if (io_request->RaidContext.raid_context.regLockFlags == REGION_TYPE_UNUSED) | if (io_request->RaidContext.raid_context.regLockFlags == REGION_TYPE_UNUSED) | ||||
cmd->request_desc->SCSIIO.RequestFlags = | cmd->request_desc->SCSIIO.RequestFlags = | ||||
(MRSAS_REQ_DESCRIPT_FLAGS_NO_LOCK << | (MRSAS_REQ_DESCRIPT_FLAGS_NO_LOCK << | ||||
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | ||||
io_request->RaidContext.raid_context.Type = MPI2_TYPE_CUDA; | io_request->RaidContext.raid_context.Type = MPI2_TYPE_CUDA; | ||||
io_request->RaidContext.raid_context.regLockFlags |= | io_request->RaidContext.raid_context.regLockFlags |= | ||||
(MR_RL_FLAGS_GRANT_DESTINATION_CPU0 | | (MR_RL_FLAGS_GRANT_DESTINATION_CPU0 | | ||||
MR_RL_FLAGS_SEQ_NUM_ENABLE); | MR_RL_FLAGS_SEQ_NUM_ENABLE); | ||||
io_request->RaidContext.raid_context.nseg = 0x1; | io_request->RaidContext.raid_context.nseg = 0x1; | ||||
} else if (sc->is_ventura || sc->is_aero) { | } else if (sc->is_ventura || sc->is_aero) { | ||||
io_request->RaidContext.raid_context_g35.Type = MPI2_TYPE_CUDA; | io_request->RaidContext.raid_context_g35.Type = MPI2_TYPE_CUDA; | ||||
io_request->RaidContext.raid_context_g35.routingFlags.bits.sqn = 1; | io_request->RaidContext.raid_context_g35.routingFlags.bits.sqn = 1; | ||||
io_request->RaidContext.raid_context_g35.nseg = 0x1; | io_request->RaidContext.raid_context_g35.nseg = 0x1; | ||||
} | } | ||||
io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST; | io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST; | ||||
io_request->DevHandle = device_id; | io_request->DevHandle = htole16(device_id); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* mrsas_build_ldio_nonrw: Builds an LDIO command | * mrsas_build_ldio_nonrw: Builds an LDIO command | ||||
* input: Adapter instance soft state | * input: Adapter instance soft state | ||||
* Pointer to command packet | * Pointer to command packet | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | if (sc->use_seqnum_jbod_fp && | ||||
pd_sync = (void *)sc->jbodmap_mem[(sc->pd_seq_map_id - 1) & 1]; | pd_sync = (void *)sc->jbodmap_mem[(sc->pd_seq_map_id - 1) & 1]; | ||||
cmd->tmCapable = pd_sync->seq[device_id].capability.tmCapable; | cmd->tmCapable = pd_sync->seq[device_id].capability.tmCapable; | ||||
/* More than 256 PD/JBOD support for Ventura */ | /* More than 256 PD/JBOD support for Ventura */ | ||||
if (sc->support_morethan256jbod) | if (sc->support_morethan256jbod) | ||||
io_request->RaidContext.raid_context.VirtualDiskTgtId = | io_request->RaidContext.raid_context.VirtualDiskTgtId = | ||||
pd_sync->seq[device_id].pdTargetId; | pd_sync->seq[device_id].pdTargetId; | ||||
else | else | ||||
io_request->RaidContext.raid_context.VirtualDiskTgtId = | io_request->RaidContext.raid_context.VirtualDiskTgtId = | ||||
device_id + 255; | htole16(device_id + 255); | ||||
io_request->RaidContext.raid_context.configSeqNum = pd_sync->seq[device_id].seqNum; | io_request->RaidContext.raid_context.configSeqNum = pd_sync->seq[device_id].seqNum; | ||||
io_request->DevHandle = pd_sync->seq[device_id].devHandle; | io_request->DevHandle = pd_sync->seq[device_id].devHandle; | ||||
if (sc->is_ventura || sc->is_aero) | if (sc->is_ventura || sc->is_aero) | ||||
io_request->RaidContext.raid_context_g35.routingFlags.bits.sqn = 1; | io_request->RaidContext.raid_context_g35.routingFlags.bits.sqn = 1; | ||||
else | else | ||||
io_request->RaidContext.raid_context.regLockFlags |= | io_request->RaidContext.raid_context.regLockFlags |= | ||||
(MR_RL_FLAGS_SEQ_NUM_ENABLE | MR_RL_FLAGS_GRANT_DESTINATION_CUDA); | (MR_RL_FLAGS_SEQ_NUM_ENABLE | MR_RL_FLAGS_GRANT_DESTINATION_CUDA); | ||||
/* raid_context.Type = MPI2_TYPE_CUDA is valid only, | /* raid_context.Type = MPI2_TYPE_CUDA is valid only, | ||||
* if FW support Jbod Sequence number | * if FW support Jbod Sequence number | ||||
*/ | */ | ||||
io_request->RaidContext.raid_context.Type = MPI2_TYPE_CUDA; | io_request->RaidContext.raid_context.Type = MPI2_TYPE_CUDA; | ||||
io_request->RaidContext.raid_context.nseg = 0x1; | io_request->RaidContext.raid_context.nseg = 0x1; | ||||
} else if (sc->fast_path_io) { | } else if (sc->fast_path_io) { | ||||
//printf("Using LD RAID map\n"); | //printf("Using LD RAID map\n"); | ||||
io_request->RaidContext.raid_context.VirtualDiskTgtId = device_id; | io_request->RaidContext.raid_context.VirtualDiskTgtId = htole16(device_id); | ||||
io_request->RaidContext.raid_context.configSeqNum = 0; | io_request->RaidContext.raid_context.configSeqNum = 0; | ||||
local_map_ptr = sc->ld_drv_map[(sc->map_id & 1)]; | local_map_ptr = sc->ld_drv_map[(sc->map_id & 1)]; | ||||
io_request->DevHandle = | io_request->DevHandle = | ||||
local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; | local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; | ||||
} else { | } else { | ||||
//printf("Using FW PATH\n"); | //printf("Using FW PATH\n"); | ||||
/* Want to send all IO via FW path */ | /* Want to send all IO via FW path */ | ||||
io_request->RaidContext.raid_context.VirtualDiskTgtId = device_id; | io_request->RaidContext.raid_context.VirtualDiskTgtId = htole16(device_id); | ||||
io_request->RaidContext.raid_context.configSeqNum = 0; | io_request->RaidContext.raid_context.configSeqNum = 0; | ||||
io_request->DevHandle = MR_DEVHANDLE_INVALID; | io_request->DevHandle = MR_DEVHANDLE_INVALID; | ||||
} | } | ||||
cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle; | cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle; | ||||
cmd->request_desc->SCSIIO.MSIxIndex = | cmd->request_desc->SCSIIO.MSIxIndex = | ||||
sc->msix_vectors ? smp_processor_id() % sc->msix_vectors : 0; | sc->msix_vectors ? smp_processor_id() % sc->msix_vectors : 0; | ||||
if (!fp_possible) { | if (!fp_possible) { | ||||
/* system pd firmware path */ | /* system pd firmware path */ | ||||
io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST; | io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST; | ||||
cmd->request_desc->SCSIIO.RequestFlags = | cmd->request_desc->SCSIIO.RequestFlags = | ||||
(MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO << | (MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO << | ||||
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | ||||
io_request->RaidContext.raid_context.timeoutValue = | io_request->RaidContext.raid_context.timeoutValue = | ||||
local_map_ptr->raidMap.fpPdIoTimeoutSec; | htole16(local_map_ptr->raidMap.fpPdIoTimeoutSec); | ||||
io_request->RaidContext.raid_context.VirtualDiskTgtId = device_id; | io_request->RaidContext.raid_context.VirtualDiskTgtId = htole16(device_id); | ||||
} else { | } else { | ||||
/* system pd fast path */ | /* system pd fast path */ | ||||
io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST; | io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST; | ||||
io_request->RaidContext.raid_context.timeoutValue = local_map_ptr->raidMap.fpPdIoTimeoutSec; | io_request->RaidContext.raid_context.timeoutValue = htole16(local_map_ptr->raidMap.fpPdIoTimeoutSec); | ||||
/* | /* | ||||
* NOTE - For system pd RW cmds only IoFlags will be FAST_PATH | * NOTE - For system pd RW cmds only IoFlags will be FAST_PATH | ||||
* Because the NON RW cmds will now go via FW Queue | * Because the NON RW cmds will now go via FW Queue | ||||
* and not the Exception queue | * and not the Exception queue | ||||
*/ | */ | ||||
if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) | if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) | ||||
io_request->IoFlags |= MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH; | io_request->IoFlags |= htole16(MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH); | ||||
cmd->request_desc->SCSIIO.RequestFlags = | cmd->request_desc->SCSIIO.RequestFlags = | ||||
(MPI2_REQ_DESCRIPT_FLAGS_FP_IO << | (MPI2_REQ_DESCRIPT_FLAGS_FP_IO << | ||||
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); | ||||
} | } | ||||
io_request->LUN[1] = ccb_h->target_lun & 0xF; | io_request->LUN[1] = ccb_h->target_lun & 0xF; | ||||
io_request->DataLength = cmd->length; | io_request->DataLength = htole32(cmd->length); | ||||
if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { | if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) { | ||||
if (cmd->sge_count > sc->max_num_sge) { | if (cmd->sge_count > sc->max_num_sge) { | ||||
device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" | device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds" | ||||
"max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); | "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge); | ||||
return (1); | return (1); | ||||
} | } | ||||
if (sc->is_ventura || sc->is_aero) | if (sc->is_ventura || sc->is_aero) | ||||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | static void mrsas_build_ieee_sgl(struct mrsas_mpt_cmd *cmd, bus_dma_segment_t *segs, int nseg) | ||||
if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) { | if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) { | ||||
pMpi25IeeeSgeChain64_t sgl_ptr_end = sgl_ptr; | pMpi25IeeeSgeChain64_t sgl_ptr_end = sgl_ptr; | ||||
sgl_ptr_end += sc->max_sge_in_main_msg - 1; | sgl_ptr_end += sc->max_sge_in_main_msg - 1; | ||||
sgl_ptr_end->Flags = 0; | sgl_ptr_end->Flags = 0; | ||||
} | } | ||||
if (nseg != 0) { | if (nseg != 0) { | ||||
for (i = 0; i < nseg; i++) { | for (i = 0; i < nseg; i++) { | ||||
sgl_ptr->Address = segs[i].ds_addr; | sgl_ptr->Address = htole64(segs[i].ds_addr); | ||||
sgl_ptr->Length = segs[i].ds_len; | sgl_ptr->Length = htole32(segs[i].ds_len); | ||||
sgl_ptr->Flags = 0; | sgl_ptr->Flags = 0; | ||||
if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) { | if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) { | ||||
if (i == nseg - 1) | if (i == nseg - 1) | ||||
sgl_ptr->Flags = IEEE_SGE_FLAGS_END_OF_LIST; | sgl_ptr->Flags = IEEE_SGE_FLAGS_END_OF_LIST; | ||||
} | } | ||||
sgl_ptr++; | sgl_ptr++; | ||||
sg_processed = i + 1; | sg_processed = i + 1; | ||||
if ((sg_processed == (sc->max_sge_in_main_msg - 1)) && | if ((sg_processed == (sc->max_sge_in_main_msg - 1)) && | ||||
(nseg > sc->max_sge_in_main_msg)) { | (nseg > sc->max_sge_in_main_msg)) { | ||||
pMpi25IeeeSgeChain64_t sg_chain; | pMpi25IeeeSgeChain64_t sg_chain; | ||||
if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) { | if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) { | ||||
if ((cmd->io_request->IoFlags & MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) | if ((cmd->io_request->IoFlags & MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) | ||||
!= MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) | != MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH) | ||||
cmd->io_request->ChainOffset = sc->chain_offset_io_request; | cmd->io_request->ChainOffset = sc->chain_offset_io_request; | ||||
else | else | ||||
cmd->io_request->ChainOffset = 0; | cmd->io_request->ChainOffset = 0; | ||||
} else | } else | ||||
cmd->io_request->ChainOffset = sc->chain_offset_io_request; | cmd->io_request->ChainOffset = sc->chain_offset_io_request; | ||||
sg_chain = sgl_ptr; | sg_chain = sgl_ptr; | ||||
if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) | if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) | ||||
sg_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT; | sg_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT; | ||||
else | else | ||||
sg_chain->Flags = (IEEE_SGE_FLAGS_CHAIN_ELEMENT | MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR); | sg_chain->Flags = (IEEE_SGE_FLAGS_CHAIN_ELEMENT | MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR); | ||||
sg_chain->Length = (sizeof(MPI2_SGE_IO_UNION) * (nseg - sg_processed)); | sg_chain->Length = htole32((sizeof(MPI2_SGE_IO_UNION) * (nseg - sg_processed))); | ||||
sg_chain->Address = cmd->chain_frame_phys_addr; | sg_chain->Address = htole64(cmd->chain_frame_phys_addr); | ||||
sgl_ptr = (pMpi25IeeeSgeChain64_t)cmd->chain_frame; | sgl_ptr = (pMpi25IeeeSgeChain64_t)cmd->chain_frame; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* mrsas_build_prp_nvme - Prepare PRPs(Physical Region Page)- SGLs specific to NVMe drives only | * mrsas_build_prp_nvme - Prepare PRPs(Physical Region Page)- SGLs specific to NVMe drives only | ||||
▲ Show 20 Lines • Show All 567 Lines • Show Last 20 Lines |