提交 e80b002b 编写于 作者: E Eric Moore 提交者: James Bottomley

[SCSI] mpt fusion: removing references to hd->ioc

Cleaning up code by accesing the ioc pointer directly instead of via hd->ioc.  In the future, most data members of struct MPT_SCSI_HOST will be either deleted or moved to struct MPT_ADAPTER.
Signed-off-by: NEric Moore <Eric.Moore@lsi.com>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 a69de507
...@@ -194,12 +194,14 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, ...@@ -194,12 +194,14 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
unsigned long flags; unsigned long flags;
int ready; int ready;
MPT_ADAPTER *ioc;
hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
ioc = hd->ioc;
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) { while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) {
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
"mptfc_block_error_handler.%d: %d:%d, port status is " "mptfc_block_error_handler.%d: %d:%d, port status is "
"DID_IMM_RETRY, deferring %s recovery.\n", "DID_IMM_RETRY, deferring %s recovery.\n",
((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
...@@ -211,7 +213,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, ...@@ -211,7 +213,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) { if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) {
dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
"%s.%d: %d:%d, failing recovery, " "%s.%d: %d:%d, failing recovery, "
"port state %d, vdevice %p.\n", caller, "port state %d, vdevice %p.\n", caller,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
...@@ -220,7 +222,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, ...@@ -220,7 +222,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
SCpnt->device->hostdata)); SCpnt->device->hostdata));
return FAILED; return FAILED;
} }
dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
"%s.%d: %d:%d, executing recovery.\n", caller, "%s.%d: %d:%d, executing recovery.\n", caller,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no, ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
...@@ -605,7 +607,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) ...@@ -605,7 +607,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
VirtDevice *vdevice; VirtDevice *vdevice;
struct scsi_target *starget; struct scsi_target *starget;
struct fc_rport *rport; struct fc_rport *rport;
MPT_ADAPTER *ioc;
starget = scsi_target(sdev); starget = scsi_target(sdev);
rport = starget_to_rport(starget); rport = starget_to_rport(starget);
...@@ -614,11 +616,12 @@ mptfc_slave_alloc(struct scsi_device *sdev) ...@@ -614,11 +616,12 @@ mptfc_slave_alloc(struct scsi_device *sdev)
return -ENXIO; return -ENXIO;
hd = (MPT_SCSI_HOST *)sdev->host->hostdata; hd = (MPT_SCSI_HOST *)sdev->host->hostdata;
ioc = hd->ioc;
vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
if (!vdevice) { if (!vdevice) {
printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n",
hd->ioc->name, sizeof(VirtDevice)); ioc->name, sizeof(VirtDevice));
return -ENOMEM; return -ENOMEM;
} }
...@@ -627,7 +630,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) ...@@ -627,7 +630,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
vtarget = starget->hostdata; vtarget = starget->hostdata;
if (vtarget->num_luns == 0) { if (vtarget->num_luns == 0) {
vtarget->ioc_id = hd->ioc->id; vtarget->ioc_id = ioc->id;
vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; vtarget->tflags = MPT_TARGET_FLAGS_Q_YES;
} }
...@@ -637,7 +640,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) ...@@ -637,7 +640,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
vtarget->num_luns++; vtarget->num_luns++;
mptfc_dump_lun_info(hd->ioc, rport, sdev, vtarget); mptfc_dump_lun_info(ioc, rport, sdev, vtarget);
return 0; return 0;
} }
......
...@@ -846,13 +846,14 @@ mptsas_target_alloc(struct scsi_target *starget) ...@@ -846,13 +846,14 @@ mptsas_target_alloc(struct scsi_target *starget)
struct sas_rphy *rphy; struct sas_rphy *rphy;
struct mptsas_portinfo *p; struct mptsas_portinfo *p;
int i; int i;
MPT_ADAPTER *ioc = hd->ioc;
vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL);
if (!vtarget) if (!vtarget)
return -ENOMEM; return -ENOMEM;
vtarget->starget = starget; vtarget->starget = starget;
vtarget->ioc_id = hd->ioc->id; vtarget->ioc_id = ioc->id;
vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; vtarget->tflags = MPT_TARGET_FLAGS_Q_YES;
id = starget->id; id = starget->id;
channel = 0; channel = 0;
...@@ -861,15 +862,15 @@ mptsas_target_alloc(struct scsi_target *starget) ...@@ -861,15 +862,15 @@ mptsas_target_alloc(struct scsi_target *starget)
* RAID volumes placed beyond the last expected port. * RAID volumes placed beyond the last expected port.
*/ */
if (starget->channel == MPTSAS_RAID_CHANNEL) { if (starget->channel == MPTSAS_RAID_CHANNEL) {
for (i=0; i < hd->ioc->raid_data.pIocPg2->NumActiveVolumes; i++) for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++)
if (id == hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID) if (id == ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID)
channel = hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus; channel = ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus;
goto out; goto out;
} }
rphy = dev_to_rphy(starget->dev.parent); rphy = dev_to_rphy(starget->dev.parent);
mutex_lock(&hd->ioc->sas_topology_mutex); mutex_lock(&ioc->sas_topology_mutex);
list_for_each_entry(p, &hd->ioc->sas_topology, list) { list_for_each_entry(p, &ioc->sas_topology, list) {
for (i = 0; i < p->num_phys; i++) { for (i = 0; i < p->num_phys; i++) {
if (p->phy_info[i].attached.sas_address != if (p->phy_info[i].attached.sas_address !=
rphy->identify.sas_address) rphy->identify.sas_address)
...@@ -881,18 +882,18 @@ mptsas_target_alloc(struct scsi_target *starget) ...@@ -881,18 +882,18 @@ mptsas_target_alloc(struct scsi_target *starget)
/* /*
* Exposing hidden raid components * Exposing hidden raid components
*/ */
if (mptscsih_is_phys_disk(hd->ioc, channel, id)) { if (mptscsih_is_phys_disk(ioc, channel, id)) {
id = mptscsih_raid_id_to_num(hd->ioc, id = mptscsih_raid_id_to_num(ioc,
channel, id); channel, id);
vtarget->tflags |= vtarget->tflags |=
MPT_TARGET_FLAGS_RAID_COMPONENT; MPT_TARGET_FLAGS_RAID_COMPONENT;
p->phy_info[i].attached.phys_disk_num = id; p->phy_info[i].attached.phys_disk_num = id;
} }
mutex_unlock(&hd->ioc->sas_topology_mutex); mutex_unlock(&ioc->sas_topology_mutex);
goto out; goto out;
} }
} }
mutex_unlock(&hd->ioc->sas_topology_mutex); mutex_unlock(&ioc->sas_topology_mutex);
kfree(vtarget); kfree(vtarget);
return -ENXIO; return -ENXIO;
...@@ -912,6 +913,7 @@ mptsas_target_destroy(struct scsi_target *starget) ...@@ -912,6 +913,7 @@ mptsas_target_destroy(struct scsi_target *starget)
struct sas_rphy *rphy; struct sas_rphy *rphy;
struct mptsas_portinfo *p; struct mptsas_portinfo *p;
int i; int i;
MPT_ADAPTER *ioc = hd->ioc;
if (!starget->hostdata) if (!starget->hostdata)
return; return;
...@@ -920,7 +922,7 @@ mptsas_target_destroy(struct scsi_target *starget) ...@@ -920,7 +922,7 @@ mptsas_target_destroy(struct scsi_target *starget)
goto out; goto out;
rphy = dev_to_rphy(starget->dev.parent); rphy = dev_to_rphy(starget->dev.parent);
list_for_each_entry(p, &hd->ioc->sas_topology, list) { list_for_each_entry(p, &ioc->sas_topology, list) {
for (i = 0; i < p->num_phys; i++) { for (i = 0; i < p->num_phys; i++) {
if (p->phy_info[i].attached.sas_address != if (p->phy_info[i].attached.sas_address !=
rphy->identify.sas_address) rphy->identify.sas_address)
...@@ -946,11 +948,12 @@ mptsas_slave_alloc(struct scsi_device *sdev) ...@@ -946,11 +948,12 @@ mptsas_slave_alloc(struct scsi_device *sdev)
VirtDevice *vdevice; VirtDevice *vdevice;
struct scsi_target *starget; struct scsi_target *starget;
int i; int i;
MPT_ADAPTER *ioc = hd->ioc;
vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
if (!vdevice) { if (!vdevice) {
printk(MYIOC_s_ERR_FMT "slave_alloc kzalloc(%zd) FAILED!\n", printk(MYIOC_s_ERR_FMT "slave_alloc kzalloc(%zd) FAILED!\n",
hd->ioc->name, sizeof(VirtDevice)); ioc->name, sizeof(VirtDevice));
return -ENOMEM; return -ENOMEM;
} }
starget = scsi_target(sdev); starget = scsi_target(sdev);
...@@ -960,8 +963,8 @@ mptsas_slave_alloc(struct scsi_device *sdev) ...@@ -960,8 +963,8 @@ mptsas_slave_alloc(struct scsi_device *sdev)
goto out; goto out;
rphy = dev_to_rphy(sdev->sdev_target->dev.parent); rphy = dev_to_rphy(sdev->sdev_target->dev.parent);
mutex_lock(&hd->ioc->sas_topology_mutex); mutex_lock(&ioc->sas_topology_mutex);
list_for_each_entry(p, &hd->ioc->sas_topology, list) { list_for_each_entry(p, &ioc->sas_topology, list) {
for (i = 0; i < p->num_phys; i++) { for (i = 0; i < p->num_phys; i++) {
if (p->phy_info[i].attached.sas_address != if (p->phy_info[i].attached.sas_address !=
rphy->identify.sas_address) rphy->identify.sas_address)
...@@ -970,15 +973,15 @@ mptsas_slave_alloc(struct scsi_device *sdev) ...@@ -970,15 +973,15 @@ mptsas_slave_alloc(struct scsi_device *sdev)
/* /*
* Exposing hidden raid components * Exposing hidden raid components
*/ */
if (mptscsih_is_phys_disk(hd->ioc, if (mptscsih_is_phys_disk(ioc,
p->phy_info[i].attached.channel, p->phy_info[i].attached.channel,
p->phy_info[i].attached.id)) p->phy_info[i].attached.id))
sdev->no_uld_attach = 1; sdev->no_uld_attach = 1;
mutex_unlock(&hd->ioc->sas_topology_mutex); mutex_unlock(&ioc->sas_topology_mutex);
goto out; goto out;
} }
} }
mutex_unlock(&hd->ioc->sas_topology_mutex); mutex_unlock(&ioc->sas_topology_mutex);
kfree(vdevice); kfree(vdevice);
return -ENXIO; return -ENXIO;
......
此差异已折叠。
...@@ -107,7 +107,8 @@ static void ...@@ -107,7 +107,8 @@ static void
mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target, mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target,
struct scsi_device *sdev) struct scsi_device *sdev)
{ {
SpiCfgData *pspi_data = &hd->ioc->spi_data; MPT_ADAPTER *ioc = hd->ioc;
SpiCfgData *pspi_data = &ioc->spi_data;
int id = (int) target->id; int id = (int) target->id;
int nvram; int nvram;
u8 width = MPT_NARROW; u8 width = MPT_NARROW;
...@@ -138,9 +139,9 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target, ...@@ -138,9 +139,9 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target,
else { else {
factor = MPT_ULTRA320; factor = MPT_ULTRA320;
if (scsi_device_qas(sdev)) { if (scsi_device_qas(sdev)) {
ddvprintk(hd->ioc, ddvprintk(ioc,
printk(MYIOC_s_DEBUG_FMT "Enabling QAS due to " printk(MYIOC_s_DEBUG_FMT "Enabling QAS due to "
"byte56=%02x on id=%d!\n", hd->ioc->name, "byte56=%02x on id=%d!\n", ioc->name,
scsi_device_qas(sdev), id)); scsi_device_qas(sdev), id));
noQas = 0; noQas = 0;
} }
...@@ -228,8 +229,8 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target, ...@@ -228,8 +229,8 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target,
/* Disable QAS in a mixed configuration case /* Disable QAS in a mixed configuration case
*/ */
ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
"Disabling QAS due to noQas=%02x on id=%d!\n", hd->ioc->name, noQas, id)); "Disabling QAS due to noQas=%02x on id=%d!\n", ioc->name, noQas, id));
} }
} }
...@@ -375,14 +376,15 @@ static int ...@@ -375,14 +376,15 @@ static int
mptspi_is_raid(struct _MPT_SCSI_HOST *hd, u32 id) mptspi_is_raid(struct _MPT_SCSI_HOST *hd, u32 id)
{ {
int i, rc = 0; int i, rc = 0;
MPT_ADAPTER *ioc = hd->ioc;
if (!hd->ioc->raid_data.pIocPg2) if (!ioc->raid_data.pIocPg2)
goto out; goto out;
if (!hd->ioc->raid_data.pIocPg2->NumActiveVolumes) if (!ioc->raid_data.pIocPg2->NumActiveVolumes)
goto out; goto out;
for (i=0; i < hd->ioc->raid_data.pIocPg2->NumActiveVolumes; i++) { for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
if (hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id) { if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id) {
rc = 1; rc = 1;
goto out; goto out;
} }
...@@ -397,15 +399,17 @@ static int mptspi_target_alloc(struct scsi_target *starget) ...@@ -397,15 +399,17 @@ static int mptspi_target_alloc(struct scsi_target *starget)
struct Scsi_Host *shost = dev_to_shost(&starget->dev); struct Scsi_Host *shost = dev_to_shost(&starget->dev);
struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)shost->hostdata; struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)shost->hostdata;
VirtTarget *vtarget; VirtTarget *vtarget;
MPT_ADAPTER *ioc;
if (hd == NULL) if (hd == NULL)
return -ENODEV; return -ENODEV;
ioc = hd->ioc;
vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL);
if (!vtarget) if (!vtarget)
return -ENOMEM; return -ENOMEM;
vtarget->ioc_id = hd->ioc->id; vtarget->ioc_id = ioc->id;
vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; vtarget->tflags = MPT_TARGET_FLAGS_Q_YES;
vtarget->id = (u8)starget->id; vtarget->id = (u8)starget->id;
vtarget->channel = (u8)starget->channel; vtarget->channel = (u8)starget->channel;
...@@ -413,34 +417,34 @@ static int mptspi_target_alloc(struct scsi_target *starget) ...@@ -413,34 +417,34 @@ static int mptspi_target_alloc(struct scsi_target *starget)
starget->hostdata = vtarget; starget->hostdata = vtarget;
if (starget->channel == 1) { if (starget->channel == 1) {
if (mptscsih_is_phys_disk(hd->ioc, 0, starget->id) == 0) if (mptscsih_is_phys_disk(ioc, 0, starget->id) == 0)
return 0; return 0;
vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT; vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT;
/* The real channel for this device is zero */ /* The real channel for this device is zero */
vtarget->channel = 0; vtarget->channel = 0;
/* The actual physdisknum (for RAID passthrough) */ /* The actual physdisknum (for RAID passthrough) */
vtarget->id = mptscsih_raid_id_to_num(hd->ioc, 0, vtarget->id = mptscsih_raid_id_to_num(ioc, 0,
starget->id); starget->id);
} }
if (starget->channel == 0 && if (starget->channel == 0 &&
mptspi_is_raid(hd, starget->id)) { mptspi_is_raid(hd, starget->id)) {
vtarget->raidVolume = 1; vtarget->raidVolume = 1;
ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
"RAID Volume @ channel=%d id=%d\n", hd->ioc->name, starget->channel, "RAID Volume @ channel=%d id=%d\n", ioc->name, starget->channel,
starget->id)); starget->id));
} }
if (hd->ioc->spi_data.nvram && if (ioc->spi_data.nvram &&
hd->ioc->spi_data.nvram[starget->id] != MPT_HOST_NVRAM_INVALID) { ioc->spi_data.nvram[starget->id] != MPT_HOST_NVRAM_INVALID) {
u32 nvram = hd->ioc->spi_data.nvram[starget->id]; u32 nvram = ioc->spi_data.nvram[starget->id];
spi_min_period(starget) = (nvram & MPT_NVRAM_SYNC_MASK) >> MPT_NVRAM_SYNC_SHIFT; spi_min_period(starget) = (nvram & MPT_NVRAM_SYNC_MASK) >> MPT_NVRAM_SYNC_SHIFT;
spi_max_width(starget) = nvram & MPT_NVRAM_WIDE_DISABLE ? 0 : 1; spi_max_width(starget) = nvram & MPT_NVRAM_WIDE_DISABLE ? 0 : 1;
} else { } else {
spi_min_period(starget) = hd->ioc->spi_data.minSyncFactor; spi_min_period(starget) = ioc->spi_data.minSyncFactor;
spi_max_width(starget) = hd->ioc->spi_data.maxBusWidth; spi_max_width(starget) = ioc->spi_data.maxBusWidth;
} }
spi_max_offset(starget) = hd->ioc->spi_data.maxSyncOffset; spi_max_offset(starget) = ioc->spi_data.maxSyncOffset;
spi_offset(starget) = 0; spi_offset(starget) = 0;
mptspi_write_width(starget, 0); mptspi_write_width(starget, 0);
...@@ -614,12 +618,13 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id) ...@@ -614,12 +618,13 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id)
{ {
MpiRaidActionRequest_t *pReq; MpiRaidActionRequest_t *pReq;
MPT_FRAME_HDR *mf; MPT_FRAME_HDR *mf;
MPT_ADAPTER *ioc = hd->ioc;
/* Get and Populate a free Frame /* Get and Populate a free Frame
*/ */
if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) { if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
ddvprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "_do_raid: no msg frames!\n", ddvprintk(ioc, printk(MYIOC_s_WARN_FMT "_do_raid: no msg frames!\n",
hd->ioc->name)); ioc->name));
return -EAGAIN; return -EAGAIN;
} }
pReq = (MpiRaidActionRequest_t *)mf; pReq = (MpiRaidActionRequest_t *)mf;
...@@ -640,8 +645,8 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id) ...@@ -640,8 +645,8 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id)
mpt_add_sge((char *)&pReq->ActionDataSGE, mpt_add_sge((char *)&pReq->ActionDataSGE,
MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1); MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1);
ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n", ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n",
hd->ioc->name, pReq->Action, channel, id)); ioc->name, pReq->Action, channel, id));
hd->pLocal = NULL; hd->pLocal = NULL;
hd->timer.expires = jiffies + HZ*10; /* 10 second timeout */ hd->timer.expires = jiffies + HZ*10; /* 10 second timeout */
...@@ -653,7 +658,7 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id) ...@@ -653,7 +658,7 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id)
hd->cmdPtr = mf; hd->cmdPtr = mf;
add_timer(&hd->timer); add_timer(&hd->timer);
mpt_put_msg_frame(hd->ioc->InternalCtx, hd->ioc, mf); mpt_put_msg_frame(ioc->InternalCtx, ioc, mf);
wait_event(hd->scandv_waitq, hd->scandv_wait_done); wait_event(hd->scandv_waitq, hd->scandv_wait_done);
if ((hd->pLocal == NULL) || (hd->pLocal->completion != 0)) if ((hd->pLocal == NULL) || (hd->pLocal->completion != 0))
...@@ -666,6 +671,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd, ...@@ -666,6 +671,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd,
struct scsi_device *sdev) struct scsi_device *sdev)
{ {
VirtTarget *vtarget = scsi_target(sdev)->hostdata; VirtTarget *vtarget = scsi_target(sdev)->hostdata;
MPT_ADAPTER *ioc = hd->ioc;
/* no DV on RAID devices */ /* no DV on RAID devices */
if (sdev->channel == 0 && if (sdev->channel == 0 &&
...@@ -676,7 +682,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd, ...@@ -676,7 +682,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd,
if (sdev->channel == 1 && if (sdev->channel == 1 &&
mptscsih_quiesce_raid(hd, 1, vtarget->channel, vtarget->id) < 0) { mptscsih_quiesce_raid(hd, 1, vtarget->channel, vtarget->id) < 0) {
starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev), starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev),
"Integrated RAID quiesce failed\n", hd->ioc->name); "Integrated RAID quiesce failed\n", ioc->name);
return; return;
} }
...@@ -687,7 +693,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd, ...@@ -687,7 +693,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd,
if (sdev->channel == 1 && if (sdev->channel == 1 &&
mptscsih_quiesce_raid(hd, 0, vtarget->channel, vtarget->id) < 0) mptscsih_quiesce_raid(hd, 0, vtarget->channel, vtarget->id) < 0)
starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev), starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev),
"Integrated RAID resume failed\n", hd->ioc->name); "Integrated RAID resume failed\n", ioc->name);
mptspi_read_parameters(sdev->sdev_target); mptspi_read_parameters(sdev->sdev_target);
spi_display_xfer_agreement(sdev->sdev_target); spi_display_xfer_agreement(sdev->sdev_target);
...@@ -700,15 +706,16 @@ static int mptspi_slave_alloc(struct scsi_device *sdev) ...@@ -700,15 +706,16 @@ static int mptspi_slave_alloc(struct scsi_device *sdev)
VirtTarget *vtarget; VirtTarget *vtarget;
VirtDevice *vdevice; VirtDevice *vdevice;
struct scsi_target *starget; struct scsi_target *starget;
MPT_ADAPTER *ioc = hd->ioc;
if (sdev->channel == 1 && if (sdev->channel == 1 &&
mptscsih_is_phys_disk(hd->ioc, 0, sdev->id) == 0) mptscsih_is_phys_disk(ioc, 0, sdev->id) == 0)
return -ENXIO; return -ENXIO;
vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
if (!vdevice) { if (!vdevice) {
printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n",
hd->ioc->name, sizeof(VirtDevice)); ioc->name, sizeof(VirtDevice));
return -ENOMEM; return -ENOMEM;
} }
...@@ -759,6 +766,7 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -759,6 +766,7 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
{ {
struct _MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; struct _MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
VirtDevice *vdevice = SCpnt->device->hostdata; VirtDevice *vdevice = SCpnt->device->hostdata;
MPT_ADAPTER *ioc = hd->ioc;
if (!vdevice || !vdevice->vtarget) { if (!vdevice || !vdevice->vtarget) {
SCpnt->result = DID_NO_CONNECT << 16; SCpnt->result = DID_NO_CONNECT << 16;
...@@ -767,14 +775,14 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -767,14 +775,14 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
} }
if (SCpnt->device->channel == 1 && if (SCpnt->device->channel == 1 &&
mptscsih_is_phys_disk(hd->ioc, 0, SCpnt->device->id) == 0) { mptscsih_is_phys_disk(ioc, 0, SCpnt->device->id) == 0) {
SCpnt->result = DID_NO_CONNECT << 16; SCpnt->result = DID_NO_CONNECT << 16;
done(SCpnt); done(SCpnt);
return 0; return 0;
} }
if (spi_dv_pending(scsi_target(SCpnt->device))) if (spi_dv_pending(scsi_target(SCpnt->device)))
ddvprintk(hd->ioc, scsi_print_command(SCpnt)); ddvprintk(ioc, scsi_print_command(SCpnt));
return mptscsih_qcmd(SCpnt,done); return mptscsih_qcmd(SCpnt,done);
} }
...@@ -1071,15 +1079,16 @@ static void mpt_work_wrapper(struct work_struct *work) ...@@ -1071,15 +1079,16 @@ static void mpt_work_wrapper(struct work_struct *work)
struct work_queue_wrapper *wqw = struct work_queue_wrapper *wqw =
container_of(work, struct work_queue_wrapper, work); container_of(work, struct work_queue_wrapper, work);
struct _MPT_SCSI_HOST *hd = wqw->hd; struct _MPT_SCSI_HOST *hd = wqw->hd;
struct Scsi_Host *shost = hd->ioc->sh; MPT_ADAPTER *ioc = hd->ioc;
struct Scsi_Host *shost = ioc->sh;
struct scsi_device *sdev; struct scsi_device *sdev;
int disk = wqw->disk; int disk = wqw->disk;
struct _CONFIG_PAGE_IOC_3 *pg3; struct _CONFIG_PAGE_IOC_3 *pg3;
kfree(wqw); kfree(wqw);
mpt_findImVolumes(hd->ioc); mpt_findImVolumes(ioc);
pg3 = hd->ioc->raid_data.pIocPg3; pg3 = ioc->raid_data.pIocPg3;
if (!pg3) if (!pg3)
return; return;
...@@ -1097,23 +1106,24 @@ static void mpt_work_wrapper(struct work_struct *work) ...@@ -1097,23 +1106,24 @@ static void mpt_work_wrapper(struct work_struct *work)
continue; continue;
starget_printk(MYIOC_s_INFO_FMT, vtarget->starget, starget_printk(MYIOC_s_INFO_FMT, vtarget->starget,
"Integrated RAID requests DV of new device\n", hd->ioc->name); "Integrated RAID requests DV of new device\n", ioc->name);
mptspi_dv_device(hd, sdev); mptspi_dv_device(hd, sdev);
} }
shost_printk(MYIOC_s_INFO_FMT, shost, shost_printk(MYIOC_s_INFO_FMT, shost,
"Integrated RAID detects new device %d\n", hd->ioc->name, disk); "Integrated RAID detects new device %d\n", ioc->name, disk);
scsi_scan_target(&hd->ioc->sh->shost_gendev, 1, disk, 0, 1); scsi_scan_target(&ioc->sh->shost_gendev, 1, disk, 0, 1);
} }
static void mpt_dv_raid(struct _MPT_SCSI_HOST *hd, int disk) static void mpt_dv_raid(struct _MPT_SCSI_HOST *hd, int disk)
{ {
struct work_queue_wrapper *wqw = kmalloc(sizeof(*wqw), GFP_ATOMIC); struct work_queue_wrapper *wqw = kmalloc(sizeof(*wqw), GFP_ATOMIC);
MPT_ADAPTER *ioc = hd->ioc;
if (!wqw) { if (!wqw) {
shost_printk(MYIOC_s_ERR_FMT, hd->ioc->sh, shost_printk(MYIOC_s_ERR_FMT, ioc->sh,
"Failed to act on RAID event for physical disk %d\n", "Failed to act on RAID event for physical disk %d\n",
hd->ioc->name, disk); ioc->name, disk);
return; return;
} }
INIT_WORK(&wqw->work, mpt_work_wrapper); INIT_WORK(&wqw->work, mpt_work_wrapper);
...@@ -1216,11 +1226,12 @@ mptspi_dv_renegotiate_work(struct work_struct *work) ...@@ -1216,11 +1226,12 @@ mptspi_dv_renegotiate_work(struct work_struct *work)
struct scsi_target *starget; struct scsi_target *starget;
struct _CONFIG_PAGE_SCSI_DEVICE_1 pg1; struct _CONFIG_PAGE_SCSI_DEVICE_1 pg1;
u32 nego; u32 nego;
MPT_ADAPTER *ioc = hd->ioc;
kfree(wqw); kfree(wqw);
if (hd->spi_pending) { if (hd->spi_pending) {
shost_for_each_device(sdev, hd->ioc->sh) { shost_for_each_device(sdev, ioc->sh) {
if (hd->spi_pending & (1 << sdev->id)) if (hd->spi_pending & (1 << sdev->id))
continue; continue;
starget = scsi_target(sdev); starget = scsi_target(sdev);
...@@ -1231,7 +1242,7 @@ mptspi_dv_renegotiate_work(struct work_struct *work) ...@@ -1231,7 +1242,7 @@ mptspi_dv_renegotiate_work(struct work_struct *work)
mptspi_write_spi_device_pg1(starget, &pg1); mptspi_write_spi_device_pg1(starget, &pg1);
} }
} else { } else {
shost_for_each_device(sdev, hd->ioc->sh) shost_for_each_device(sdev, ioc->sh)
mptspi_dv_device(hd, sdev); mptspi_dv_device(hd, sdev);
} }
} }
...@@ -1483,7 +1494,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1483,7 +1494,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Some versions of the firmware don't support page 0; without /* Some versions of the firmware don't support page 0; without
* that we can't get the parameters */ * that we can't get the parameters */
if (hd->ioc->spi_data.sdp0length != 0) if (ioc->spi_data.sdp0length != 0)
sh->transportt = mptspi_transport_template; sh->transportt = mptspi_transport_template;
error = scsi_add_host (sh, &ioc->pcidev->dev); error = scsi_add_host (sh, &ioc->pcidev->dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册