Commit 82ffb671 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[SCSI] fusion core changes for SAS support

 - various bits for SAS support from the LSI driver.
 - use the device private data for the fusion target private data.
   this should be using the midlayer target data framework, but we
   can't move over to that until fusion has been switched to the
   generic DV code
 - use target ID and channel from the fusion target private data,
   because those in scsi_device will be different for mptsas
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 3ed7a470
This diff is collapsed.
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#include "lsi/mpi_fc.h" /* Fibre Channel (lowlevel) support */ #include "lsi/mpi_fc.h" /* Fibre Channel (lowlevel) support */
#include "lsi/mpi_targ.h" /* SCSI/FCP Target protcol support */ #include "lsi/mpi_targ.h" /* SCSI/FCP Target protcol support */
#include "lsi/mpi_tool.h" /* Tools support */ #include "lsi/mpi_tool.h" /* Tools support */
#include "lsi/mpi_sas.h" /* SAS support */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
...@@ -477,6 +478,14 @@ typedef struct _ScsiCfgData { ...@@ -477,6 +478,14 @@ typedef struct _ScsiCfgData {
u8 rsvd[1]; u8 rsvd[1];
} ScsiCfgData; } ScsiCfgData;
typedef struct _SasCfgData {
u8 ptClear; /* 1 to automatically clear the
* persistent table.
* 0 to disable
* automatic clearing.
*/
}SasCfgData;
/* /*
* Adapter Structure - pci_dev specific. Maximum: MPT_MAX_ADAPTERS * Adapter Structure - pci_dev specific. Maximum: MPT_MAX_ADAPTERS
*/ */
...@@ -530,11 +539,15 @@ typedef struct _MPT_ADAPTER ...@@ -530,11 +539,15 @@ typedef struct _MPT_ADAPTER
u8 *sense_buf_pool; u8 *sense_buf_pool;
dma_addr_t sense_buf_pool_dma; dma_addr_t sense_buf_pool_dma;
u32 sense_buf_low_dma; u32 sense_buf_low_dma;
u8 *HostPageBuffer; /* SAS - host page buffer support */
u32 HostPageBuffer_sz;
dma_addr_t HostPageBuffer_dma;
int mtrr_reg; int mtrr_reg;
struct pci_dev *pcidev; /* struct pci_dev pointer */ struct pci_dev *pcidev; /* struct pci_dev pointer */
u8 __iomem *memmap; /* mmap address */ u8 __iomem *memmap; /* mmap address */
struct Scsi_Host *sh; /* Scsi Host pointer */ struct Scsi_Host *sh; /* Scsi Host pointer */
ScsiCfgData spi_data; /* Scsi config. data */ ScsiCfgData spi_data; /* Scsi config. data */
SasCfgData sas_data; /* Sas config. data */
MPT_IOCTL *ioctl; /* ioctl data pointer */ MPT_IOCTL *ioctl; /* ioctl data pointer */
struct proc_dir_entry *ioc_dentry; struct proc_dir_entry *ioc_dentry;
struct _MPT_ADAPTER *alt_ioc; /* ptr to 929 bound adapter port */ struct _MPT_ADAPTER *alt_ioc; /* ptr to 929 bound adapter port */
...@@ -560,6 +573,9 @@ typedef struct _MPT_ADAPTER ...@@ -560,6 +573,9 @@ typedef struct _MPT_ADAPTER
IOCFactsReply_t facts; IOCFactsReply_t facts;
PortFactsReply_t pfacts[2]; PortFactsReply_t pfacts[2];
FCPortPage0_t fc_port_page0[2]; FCPortPage0_t fc_port_page0[2];
struct timer_list persist_timer; /* persist table timer */
int persist_wait_done; /* persist completion flag */
u8 persist_reply_frame[MPT_DEFAULT_FRAME_SIZE]; /* persist reply */
LANPage0_t lan_cnfg_page0; LANPage0_t lan_cnfg_page0;
LANPage1_t lan_cnfg_page1; LANPage1_t lan_cnfg_page1;
/* /*
...@@ -579,6 +595,7 @@ typedef struct _MPT_ADAPTER ...@@ -579,6 +595,7 @@ typedef struct _MPT_ADAPTER
int InternalCtx; int InternalCtx;
struct list_head list; struct list_head list;
struct net_device *netdev; struct net_device *netdev;
struct list_head sas_topology;
} MPT_ADAPTER; } MPT_ADAPTER;
/* /*
...@@ -964,6 +981,7 @@ extern void mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size); ...@@ -964,6 +981,7 @@ extern void mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size);
extern void mpt_free_fw_memory(MPT_ADAPTER *ioc); extern void mpt_free_fw_memory(MPT_ADAPTER *ioc);
extern int mpt_findImVolumes(MPT_ADAPTER *ioc); extern int mpt_findImVolumes(MPT_ADAPTER *ioc);
extern int mpt_read_ioc_pg_3(MPT_ADAPTER *ioc); extern int mpt_read_ioc_pg_3(MPT_ADAPTER *ioc);
extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
/* /*
* Public data decl's... * Public data decl's...
......
...@@ -1256,8 +1256,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -1256,8 +1256,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
MPT_SCSI_HOST *hd; MPT_SCSI_HOST *hd;
MPT_FRAME_HDR *mf; MPT_FRAME_HDR *mf;
SCSIIORequest_t *pScsiReq; SCSIIORequest_t *pScsiReq;
VirtDevice *pTarget; VirtDevice *pTarget = SCpnt->device->hostdata;
int target;
int lun; int lun;
u32 datalen; u32 datalen;
u32 scsictl; u32 scsictl;
...@@ -1267,12 +1266,9 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -1267,12 +1266,9 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
int ii; int ii;
hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
target = SCpnt->device->id;
lun = SCpnt->device->lun; lun = SCpnt->device->lun;
SCpnt->scsi_done = done; SCpnt->scsi_done = done;
pTarget = hd->Targets[target];
dmfprintk((MYIOC_s_INFO_FMT "qcmd: SCpnt=%p, done()=%p\n", dmfprintk((MYIOC_s_INFO_FMT "qcmd: SCpnt=%p, done()=%p\n",
(hd && hd->ioc) ? hd->ioc->name : "ioc?", SCpnt, done)); (hd && hd->ioc) ? hd->ioc->name : "ioc?", SCpnt, done));
...@@ -1315,7 +1311,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -1315,7 +1311,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
/* Default to untagged. Once a target structure has been allocated, /* Default to untagged. Once a target structure has been allocated,
* use the Inquiry data to determine if device supports tagged. * use the Inquiry data to determine if device supports tagged.
*/ */
if ( pTarget if (pTarget
&& (pTarget->tflags & MPT_TARGET_FLAGS_Q_YES) && (pTarget->tflags & MPT_TARGET_FLAGS_Q_YES)
&& (SCpnt->device->tagged_supported)) { && (SCpnt->device->tagged_supported)) {
scsictl = scsidir | MPI_SCSIIO_CONTROL_SIMPLEQ; scsictl = scsidir | MPI_SCSIIO_CONTROL_SIMPLEQ;
...@@ -1325,8 +1321,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -1325,8 +1321,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
/* Use the above information to set up the message frame /* Use the above information to set up the message frame
*/ */
pScsiReq->TargetID = (u8) target; pScsiReq->TargetID = (u8) pTarget->target_id;
pScsiReq->Bus = (u8) SCpnt->device->channel; pScsiReq->Bus = pTarget->bus_id;
pScsiReq->ChainOffset = 0; pScsiReq->ChainOffset = 0;
pScsiReq->Function = MPI_FUNCTION_SCSI_IO_REQUEST; pScsiReq->Function = MPI_FUNCTION_SCSI_IO_REQUEST;
pScsiReq->CDBLength = SCpnt->cmd_len; pScsiReq->CDBLength = SCpnt->cmd_len;
...@@ -1378,7 +1374,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -1378,7 +1374,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
if (hd->ioc->bus_type == SCSI) { if (hd->ioc->bus_type == SCSI) {
int dvStatus = hd->ioc->spi_data.dvStatus[target]; int dvStatus = hd->ioc->spi_data.dvStatus[pTarget->target_id];
int issueCmd = 1; int issueCmd = 1;
if (dvStatus || hd->ioc->spi_data.forceDv) { if (dvStatus || hd->ioc->spi_data.forceDv) {
...@@ -2180,6 +2176,7 @@ mptscsih_slave_alloc(struct scsi_device *device) ...@@ -2180,6 +2176,7 @@ mptscsih_slave_alloc(struct scsi_device *device)
out: out:
vdev->num_luns++; vdev->num_luns++;
device->hostdata = vdev;
return 0; return 0;
} }
......
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