Commit 506bc1a0 authored by Sumit Saxena's avatar Sumit Saxena Committed by Martin K. Petersen

scsi: mpi3mr: Add support for MPT commands

There are certain management commands which require firmware intervention.
These commands are termed MPT commands. Add support for them.

Link: https://lore.kernel.org/r/20220429211641.642010-5-sumit.saxena@broadcom.comReviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f3de4706
...@@ -189,6 +189,27 @@ extern int prot_mask; ...@@ -189,6 +189,27 @@ extern int prot_mask;
*/ */
#define MPI3MR_MAX_APP_XFER_SECTORS (2048 + 512) #define MPI3MR_MAX_APP_XFER_SECTORS (2048 + 512)
/**
* struct mpi3mr_buf_map - local structure to
* track kernel and user buffers associated with an BSG
* structure.
*
* @bsg_buf: BSG buffer virtual address
* @bsg_buf_len: BSG buffer length
* @kern_buf: Kernel buffer virtual address
* @kern_buf_len: Kernel buffer length
* @kern_buf_dma: Kernel buffer DMA address
* @data_dir: Data direction.
*/
struct mpi3mr_buf_map {
void *bsg_buf;
u32 bsg_buf_len;
void *kern_buf;
u32 kern_buf_len;
dma_addr_t kern_buf_dma;
u8 data_dir;
};
/* IOC State definitions */ /* IOC State definitions */
enum mpi3mr_iocstate { enum mpi3mr_iocstate {
MRIOC_STATE_READY = 1, MRIOC_STATE_READY = 1,
...@@ -557,6 +578,7 @@ struct mpi3mr_sdev_priv_data { ...@@ -557,6 +578,7 @@ struct mpi3mr_sdev_priv_data {
* @ioc_status: IOC status from the firmware * @ioc_status: IOC status from the firmware
* @ioc_loginfo:IOC log info from the firmware * @ioc_loginfo:IOC log info from the firmware
* @is_waiting: Is the command issued in block mode * @is_waiting: Is the command issued in block mode
* @is_sense: Is Sense data present
* @retry_count: Retry count for retriable commands * @retry_count: Retry count for retriable commands
* @host_tag: Host tag used by the command * @host_tag: Host tag used by the command
* @callback: Callback for non blocking commands * @callback: Callback for non blocking commands
...@@ -572,6 +594,7 @@ struct mpi3mr_drv_cmd { ...@@ -572,6 +594,7 @@ struct mpi3mr_drv_cmd {
u16 ioc_status; u16 ioc_status;
u32 ioc_loginfo; u32 ioc_loginfo;
u8 is_waiting; u8 is_waiting;
u8 is_sense;
u8 retry_count; u8 retry_count;
u16 host_tag; u16 host_tag;
...@@ -993,5 +1016,11 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc, ...@@ -993,5 +1016,11 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,
int mpi3mr_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num); int mpi3mr_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num);
void mpi3mr_bsg_init(struct mpi3mr_ioc *mrioc); void mpi3mr_bsg_init(struct mpi3mr_ioc *mrioc);
void mpi3mr_bsg_exit(struct mpi3mr_ioc *mrioc); void mpi3mr_bsg_exit(struct mpi3mr_ioc *mrioc);
int mpi3mr_issue_tm(struct mpi3mr_ioc *mrioc, u8 tm_type,
u16 handle, uint lun, u16 htag, ulong timeout,
struct mpi3mr_drv_cmd *drv_cmd,
u8 *resp_code, struct scsi_cmnd *scmd);
struct mpi3mr_tgt_dev *mpi3mr_get_tgtdev_by_handle(
struct mpi3mr_ioc *mrioc, u16 handle);
#endif /*MPI3MR_H_INCLUDED*/ #endif /*MPI3MR_H_INCLUDED*/
This diff is collapsed.
...@@ -124,6 +124,31 @@ ...@@ -124,6 +124,31 @@
#endif /* MPT3SAS_DEBUG_H_INCLUDED */ #endif /* MPT3SAS_DEBUG_H_INCLUDED */
/**
* dprint_dump - print contents of a memory buffer
* @req: Pointer to a memory buffer
* @sz: Memory buffer size
* @namestr: Name String to identify the buffer type
*/
static inline void
dprint_dump(void *req, int sz, const char *name_string)
{
int i;
__le32 *mfp = (__le32 *)req;
sz = sz/4;
if (name_string)
pr_info("%s:\n\t", name_string);
else
pr_info("request:\n\t");
for (i = 0; i < sz; i++) {
if (i && ((i % 8) == 0))
pr_info("\n\t");
pr_info("%08x ", le32_to_cpu(mfp[i]));
}
pr_info("\n");
}
/** /**
* dprint_dump_req - print message frame contents * dprint_dump_req - print message frame contents
* @req: pointer to message frame * @req: pointer to message frame
......
...@@ -634,7 +634,7 @@ static struct mpi3mr_tgt_dev *__mpi3mr_get_tgtdev_by_handle( ...@@ -634,7 +634,7 @@ static struct mpi3mr_tgt_dev *__mpi3mr_get_tgtdev_by_handle(
* *
* Return: Target device reference. * Return: Target device reference.
*/ */
static struct mpi3mr_tgt_dev *mpi3mr_get_tgtdev_by_handle( struct mpi3mr_tgt_dev *mpi3mr_get_tgtdev_by_handle(
struct mpi3mr_ioc *mrioc, u16 handle) struct mpi3mr_ioc *mrioc, u16 handle)
{ {
struct mpi3mr_tgt_dev *tgtdev; struct mpi3mr_tgt_dev *tgtdev;
...@@ -2996,7 +2996,7 @@ inline void mpi3mr_poll_pend_io_completions(struct mpi3mr_ioc *mrioc) ...@@ -2996,7 +2996,7 @@ inline void mpi3mr_poll_pend_io_completions(struct mpi3mr_ioc *mrioc)
* *
* Return: 0 on success, non-zero on errors * Return: 0 on success, non-zero on errors
*/ */
static int mpi3mr_issue_tm(struct mpi3mr_ioc *mrioc, u8 tm_type, int mpi3mr_issue_tm(struct mpi3mr_ioc *mrioc, u8 tm_type,
u16 handle, uint lun, u16 htag, ulong timeout, u16 handle, uint lun, u16 htag, ulong timeout,
struct mpi3mr_drv_cmd *drv_cmd, struct mpi3mr_drv_cmd *drv_cmd,
u8 *resp_code, struct scsi_cmnd *scmd) u8 *resp_code, struct scsi_cmnd *scmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment