Now Driver expose Secure Jbod Support via driver_operations in MFI INIT Frame.

FW expose Secure Jbod support via Controller properity.

Firmware expect IOs to be received from different IO path than
conventional fast path queue, in case of SED drives.

To have Secure jbod support user need driver and firmware support.

Reviewed by:    ambrisko
MFC after:  2 weeks
Sponsored by:   AVAGO Technologies
This commit is contained in:
Kashyap D Desai 2015-05-06 10:36:53 +00:00
parent 5844115e3a
commit 77cf7df804
3 changed files with 92 additions and 38 deletions

View File

@ -2095,6 +2095,12 @@ mrsas_init_fw(struct mrsas_softc *sc)
if (mrsas_get_ctrl_info(sc, ctrl_info)) {
device_printf(sc->mrsas_dev, "Unable to get FW ctrl_info.\n");
}
sc->secure_jbod_support =
(u_int8_t) ctrl_info->adapterOperations3.supportSecurityonJBOD;
if (sc->secure_jbod_support)
device_printf(sc->mrsas_dev, "FW supports SED \n");
sc->max256vdSupport =
(u_int8_t)ctrl_info->adapterOperations3.supportMaxExtLDs;
@ -2326,6 +2332,7 @@ mrsas_ioc_init(struct mrsas_softc *sc)
init_frame->driver_ver_hi = 0;
}
init_frame->driver_operations.mfi_capabilities.support_max_255lds = 1;
init_frame->driver_operations.mfi_capabilities.security_protocol_cmds_fw = 1;
phys_addr = (bus_addr_t)sc->ioc_init_phys_mem + 1024;
init_frame->queue_info_new_phys_addr_lo = phys_addr;
init_frame->data_xfer_len = sizeof(Mpi2IOCInitRequest_t);

View File

@ -1315,6 +1315,13 @@ typedef enum _REGION_TYPE {
#define MRSAS_REQ_STATE_TRAN 2
#define MRSAS_REQ_STATE_COMPLETE 3
typedef enum _MR_SCSI_CMD_TYPE {
READ_WRITE_LDIO = 0,
NON_READ_WRITE_LDIO = 1,
READ_WRITE_SYSPDIO = 2,
NON_READ_WRITE_SYSPDIO = 3,
} MR_SCSI_CMD_TYPE;
enum mrsas_req_flags {
MRSAS_DIR_UNKNOWN = 0x1,
MRSAS_DIR_IN = 0x2,
@ -1897,10 +1904,27 @@ struct mrsas_ctrl_info {
char reserved6[4]; /* 0x7E4 RESERVED FOR IOV */
struct { /* 0x7E8 */
u_int32_t resrved:5;
u_int32_t supportMaxExtLDs:1;
u_int32_t reserved1:26;
} adapterOperations3;
u_int32_t supportPersonalityChange:2;
u_int32_t supportThermalPollInterval:1;
u_int32_t supportDisableImmediateIO:1;
u_int32_t supportT10RebuildAssist:1;
u_int32_t supportMaxExtLDs:1;
u_int32_t supportCrashDump:1;
u_int32_t supportSwZone:1;
u_int32_t supportDebugQueue:1;
u_int32_t supportNVCacheErase:1;
u_int32_t supportForceTo512e:1;
u_int32_t supportHOQRebuild:1;
u_int32_t supportAllowedOpsforDrvRemoval:1;
u_int32_t supportDrvActivityLEDSetting:1;
u_int32_t supportNVDRAM:1;
u_int32_t supportForceFlash:1;
u_int32_t supportDisableSESMonitoring:1;
u_int32_t supportCacheBypassModes:1;
u_int32_t supportSecurityonJBOD:1;
u_int32_t discardCacheDuringLDDelete:1;
u_int32_t reserved:12;
} adapterOperations3;
u_int8_t pad[0x800 - 0x7EC]; /* 0x7EC */
} __packed;
@ -1970,8 +1994,11 @@ typedef union _MFI_CAPABILITIES {
u_int32_t support_additional_msix:1;
u_int32_t support_fastpath_wb:1;
u_int32_t support_max_255lds:1;
u_int32_t reserved:28;
} mfi_capabilities;
u_int32_t support_ndrive_r1_lb:1;
u_int32_t support_core_affinity:1;
u_int32_t security_protocol_cmds_fw:1;
u_int32_t reserved:25;
} mfi_capabilities;
u_int32_t reg;
} MFI_CAPABILITIES;
@ -2710,6 +2737,7 @@ struct mrsas_softc {
LD_LOAD_BALANCE_INFO load_balance_info[MAX_LOGICAL_DRIVES_EXT];
LD_SPAN_INFO log_to_span[MAX_LOGICAL_DRIVES_EXT];
u_int8_t secure_jbod_support;
u_int8_t max256vdSupport;
u_int16_t fw_supported_vd_count;
u_int16_t fw_supported_pd_count;

View File

@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
* Function prototypes
*/
int mrsas_cam_attach(struct mrsas_softc *sc);
int mrsas_ldio_inq(struct cam_sim *sim, union ccb *ccb);
int mrsas_find_io_type(struct cam_sim *sim, union ccb *ccb);
int mrsas_bus_scan(struct mrsas_softc *sc);
int mrsas_bus_scan_sim(struct mrsas_softc *sc, struct cam_sim *sim);
int mrsas_map_request(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd);
@ -499,7 +499,9 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim,
bcopy(csio->cdb_io.cdb_bytes, cmd->io_request->CDB.CDB32, csio->cdb_len);
mtx_lock(&sc->raidmap_lock);
if (mrsas_ldio_inq(sim, ccb)) {
/* Check for IO type READ-WRITE targeted for Logical Volume */
if (mrsas_find_io_type(sim, ccb) == READ_WRITE_LDIO) {
/* Build READ-WRITE IO for Logical Volume */
if (mrsas_build_ldio(sc, cmd, ccb)) {
device_printf(sc->mrsas_dev, "Build LDIO failed.\n");
mtx_unlock(&sc->raidmap_lock);
@ -546,20 +548,16 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim,
}
/*
* mrsas_ldio_inq: Determines if IO is read/write or inquiry
* mrsas_find_io_type: Determines if IO is read/write or inquiry
* input: pointer to CAM Control Block
*
* This function determines if the IO is read/write or inquiry. It returns a 1
* if the IO is read/write and 0 if it is inquiry.
*/
int
mrsas_ldio_inq(struct cam_sim *sim, union ccb *ccb)
int mrsas_find_io_type(struct cam_sim *sim, union ccb *ccb)
{
struct ccb_scsiio *csio = &(ccb->csio);
if (cam_sim_bus(sim) == 1)
return (0);
switch (csio->cdb_io.cdb_bytes[0]) {
case READ_10:
case WRITE_10:
@ -569,9 +567,11 @@ mrsas_ldio_inq(struct cam_sim *sim, union ccb *ccb)
case WRITE_6:
case READ_16:
case WRITE_16:
return 1;
return (cam_sim_bus(sim) ?
READ_WRITE_SYSPDIO : READ_WRITE_LDIO);
default:
return 0;
return (cam_sim_bus(sim) ?
NON_READ_WRITE_SYSPDIO : NON_READ_WRITE_LDIO);
}
}
@ -876,35 +876,54 @@ mrsas_build_dcdb(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
device_id = ccb_h->target_id;
map_ptr = sc->ld_drv_map[(sc->map_id & 1)];
/* Check if this is for system PD */
/*
* Check if this is RW for system PD or
* it's a NON RW for sys PD and there is NO secure jbod FW support
*/
if (cam_sim_bus(sim) == 1 &&
sc->pd_list[device_id].driveState == MR_PD_STATE_SYSTEM) {
io_request->Function = 0;
io_request->DevHandle = map_ptr->raidMap.devHndlInfo[device_id].
curDevHdl;
io_request->RaidContext.timeoutValue = map_ptr->raidMap.fpPdIoTimeoutSec;
io_request->RaidContext.regLockFlags = 0;
io_request->RaidContext.regLockRowLBA = 0;
io_request->RaidContext.regLockLength = 0;
sc->pd_list[device_id].driveState == MR_PD_STATE_SYSTEM){
io_request->RaidContext.RAIDFlags = MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD
<< MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT;
if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY))
io_request->IoFlags |= MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH;
cmd->request_desc->SCSIIO.RequestFlags =
(MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY <<
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
cmd->request_desc->SCSIIO.DevHandle =
map_ptr->raidMap.devHndlInfo[device_id].curDevHdl;
io_request->DevHandle =
map_ptr->raidMap.devHndlInfo[device_id].curDevHdl;
io_request->RaidContext.RAIDFlags =
MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD <<
MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT;
cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle;
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(sc->secure_jbod_support && (mrsas_find_io_type(sim, ccb) == NON_READ_WRITE_SYSPDIO)) {
/* system pd firmware path */
io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST;
cmd->request_desc->SCSIIO.RequestFlags =
(MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO << MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
} else {
/* system pd fast path */
io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST;
io_request->RaidContext.timeoutValue = map_ptr->raidMap.fpPdIoTimeoutSec;
io_request->RaidContext.regLockFlags = 0;
io_request->RaidContext.regLockRowLBA = 0;
io_request->RaidContext.regLockLength = 0;
cmd->request_desc->SCSIIO.RequestFlags =
(MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY <<
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
/*
* NOTE - For system pd RW cmds only IoFlags will be FAST_PATH
* Because the NON RW cmds will now go via FW Queue
* and not the Exception queue
*/
if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY))
io_request->IoFlags |= MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH;
}
} else {
io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST;
/* FW path for SysPD or LD Non-RW (SCSI management commands)*/
io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST;
io_request->DevHandle = device_id;
cmd->request_desc->SCSIIO.RequestFlags =
(MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO <<
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
(MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO <<
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
}
io_request->RaidContext.VirtualDiskTgtId = device_id;