Commit cbb2050f authored by Mike Christie's avatar Mike Christie Committed by Christoph Hellwig

[PATCH] fixes compile errors in cpqfc driver

The attached path fixes the compile errors in the cpqfc driver caused by
changes in scsi_cmnd. And, per Christoph and James's comments
http://marc.theaimsgroup.com/?l=linux-scsi&m=105099392420649&w=2 I have
removed the scsi_cmnd stack usage.

I do not have the hardware, so I have only verified that it compiles.


cpqfcTSinit.c    |   35 +++++++++++++++++++++---------
cpqfcTSstructs.h |    1
cpqfcTSworker.c  |   63
+++++++++++++++++++++++++++++++------------------------
3 files changed, 61 insertions(+), 38 deletions(-)
parent 7a173f0f
......@@ -549,14 +549,14 @@ void cpqfc_free_private_data(CPQFCHBA *hba, cpqfc_passthru_private_t *data)
hba->private_data_bits+(i/BITS_PER_LONG));
}
int cpqfcTS_ioctl( Scsi_Device *ScsiDev, int Cmnd, void *arg)
int cpqfcTS_ioctl( struct scsi_device *ScsiDev, int Cmnd, void *arg)
{
int result = 0;
struct Scsi_Host *HostAdapter = ScsiDev->host;
CPQFCHBA *cpqfcHBAdata = (CPQFCHBA *)HostAdapter->hostdata;
PTACHYON fcChip = &cpqfcHBAdata->fcChip;
PFC_LOGGEDIN_PORT pLoggedInPort = NULL;
Scsi_Cmnd DumCmnd;
struct scsi_cmnd *DumCmnd;
int i, j;
VENDOR_IOCTL_REQ ioc;
cpqfc_passthru_t *vendor_cmd;
......@@ -723,13 +723,16 @@ int cpqfcTS_ioctl( Scsi_Device *ScsiDev, int Cmnd, void *arg)
/* DumCmnd.target = ScsiDev->id; */
/* DumCmnd.lun = ScsiDev->lun; */
DumCmnd.device = ScsiDev;
DumCmnd = scsi_get_command (ScsiDev, GFP_KERNEL);
if (!DumCmnd)
return -ENOMEM;
pLoggedInPort = fcFindLoggedInPort( fcChip,
&DumCmnd, // search Scsi Nexus
DumCmnd, // search Scsi Nexus
0, // DON'T search linked list for FC port id
NULL, // DON'T search linked list for FC WWN
NULL); // DON'T care about end of list
scsi_put_command (DumCmnd);
if (pLoggedInPort == NULL) {
result = -ENXIO;
break;
......@@ -918,7 +921,8 @@ static int copy_info(struct info_str *info, char *fmt, ...)
int cpqfcTS_proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length,
int inout)
{
Scsi_Cmnd DumCmnd;
struct scsi_cmnd *DumCmnd;
struct scsi_device *ScsiDev;
int Chan, Targ, i;
struct info_str info;
CPQFCHBA *cpqfcHBA;
......@@ -946,13 +950,21 @@ int cpqfcTS_proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t
#define DISPLAY_WWN_INFO
#ifdef DISPLAY_WWN_INFO
ScsiDev = scsi_get_host_dev (host);
if (!ScsiDev)
return -ENOMEM;
DumCmnd = scsi_get_command (ScsiDev, GFP_KERNEL);
if (!DumCmnd) {
scsi_free_host_dev (ScsiDev);
return -ENOMEM;
}
copy_info(&info, "WWN database: (\"port_id: 000000\" means disconnected)\n");
for ( Chan=0; Chan <= host->max_channel; Chan++) {
DumCmnd.channel = Chan;
DumCmnd->device->channel = Chan;
for (Targ=0; Targ <= host->max_id; Targ++) {
DumCmnd.target = Targ;
DumCmnd->device->id = Targ;
if ((pLoggedInPort = fcFindLoggedInPort( fcChip,
&DumCmnd, // search Scsi Nexus
DumCmnd, // search Scsi Nexus
0, // DON'T search list for FC port id
NULL, // DON'T search list for FC WWN
NULL))){ // DON'T care about end of list
......@@ -966,6 +978,9 @@ int cpqfcTS_proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t
}
}
}
scsi_put_command (DumCmnd);
scsi_free_host_dev (ScsiDev);
#endif
......@@ -1578,7 +1593,7 @@ int cpqfcTS_TargetDeviceReset( Scsi_Device *ScsiDev,
// Scsi_Request, etc.
// For now, so people don't fall into a hole...
return -ENOTSUPP;
/*
// printk(" ENTERING cpqfcTS_TargetDeviceReset() - flag=%d \n",reset_flags);
if (ScsiDev->host->eh_active) return FAILED;
......@@ -1600,7 +1615,7 @@ return -ENOTSUPP;
SCpnt->request->CPQFC_WAITING = NULL;
}
/*
if(driver_byte(SCpnt->result) != 0)
switch(SCpnt->sense_buffer[2] & 0xf) {
case ILLEGAL_REQUEST:
......
......@@ -696,7 +696,6 @@ typedef struct
ULONG port_id; // a FC 24-bit address of port (lower 8 bits = al_pa)
Scsi_Cmnd ScsiCmnd; // command buffer for Report Luns
#define REPORT_LUNS_PL 256
UCHAR ReportLunsPayload[REPORT_LUNS_PL];
......
......@@ -30,6 +30,7 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/smp_lock.h>
#include <linux/pci.h>
#define __KERNEL_SYSCALLS__
......@@ -1196,9 +1197,9 @@ void cpqfcTSTerminateExchange(
// have to terminate by SCSI target, NOT port_id.
if( Exchanges->fcExchange[x_ID].Cmnd) // Cmnd in progress?
{
if( (Exchanges->fcExchange[x_ID].Cmnd->target == ScsiNexus->target)
if( (Exchanges->fcExchange[x_ID].Cmnd->device->id == ScsiNexus->target)
&&
(Exchanges->fcExchange[x_ID].Cmnd->channel == ScsiNexus->channel))
(Exchanges->fcExchange[x_ID].Cmnd->device->channel == ScsiNexus->channel))
{
Exchanges->fcExchange[x_ID].status = TerminateStatus;
cpqfcTSPutLinkQue( cpqfcHBAdata, BLS_ABTS, &x_ID ); // timed-out
......@@ -2681,7 +2682,7 @@ static void SendLogins( CPQFCHBA *cpqfcHBAdata, __u32 *FabricPortIds )
// D. Deming, 1994, pg 7-19 (ISBN 1-879936-08-9)
static void ScsiReportLunsDone(Scsi_Cmnd *Cmnd)
{
struct Scsi_Host *HostAdapter = Cmnd->host;
struct Scsi_Host *HostAdapter = Cmnd->device->host;
CPQFCHBA *cpqfcHBAdata = (CPQFCHBA *)HostAdapter->hostdata;
PTACHYON fcChip = &cpqfcHBAdata->fcChip;
FC_EXCHANGES *Exchanges = fcChip->Exchanges;
......@@ -2887,11 +2888,11 @@ static void
call_scsi_done(Scsi_Cmnd *Cmnd)
{
CPQFCHBA *hba;
hba = (CPQFCHBA *) Cmnd->host->hostdata;
hba = (CPQFCHBA *) Cmnd->device->host->hostdata;
// Was this command a cpqfc passthru ioctl ?
if (Cmnd->sc_request != NULL && Cmnd->host != NULL &&
Cmnd->host->hostdata != NULL &&
is_private_data_of_cpqfc((CPQFCHBA *) Cmnd->host->hostdata,
if (Cmnd->sc_request != NULL && Cmnd->device->host != NULL &&
Cmnd->device->host->hostdata != NULL &&
is_private_data_of_cpqfc((CPQFCHBA *) Cmnd->device->host->hostdata,
Cmnd->sc_request->upper_private_data)) {
cpqfc_free_private_data(hba,
Cmnd->sc_request->upper_private_data);
......@@ -2918,7 +2919,8 @@ static void IssueReportLunsCommand(
{
PTACHYON fcChip = &cpqfcHBAdata->fcChip;
PFC_LOGGEDIN_PORT pLoggedInPort;
Scsi_Cmnd *Cmnd;
struct scsi_cmnd *Cmnd = NULL;
struct scsi_device *ScsiDev = NULL;
LONG x_ID;
ULONG ulStatus;
UCHAR *ucBuff;
......@@ -2942,17 +2944,20 @@ static void IssueReportLunsCommand(
if( !(pLoggedInPort->fcp_info & TARGET_FUNCTION) )
goto Done; // forget it - FC device not a "target"
// now use the port's Scsi Command buffer for the
// Report Luns Command
Cmnd = &pLoggedInPort->ScsiCmnd;
ScsiDev = scsi_get_host_dev (cpqfcHBAdata->HostAdapter);
if (!ScsiDev)
goto Done;
Cmnd = scsi_get_command (ScsiDev, GFP_KERNEL);
if (!Cmnd)
goto Done;
ucBuff = pLoggedInPort->ReportLunsPayload;
memset( Cmnd, 0, sizeof(Scsi_Cmnd));
memset( ucBuff, 0, REPORT_LUNS_PL);
Cmnd->scsi_done = ScsiReportLunsDone;
Cmnd->host = cpqfcHBAdata->HostAdapter;
Cmnd->request_buffer = pLoggedInPort->ReportLunsPayload;
Cmnd->request_bufflen = REPORT_LUNS_PL;
......@@ -2962,8 +2967,8 @@ static void IssueReportLunsCommand(
Cmnd->cmnd[9] = (UCHAR)REPORT_LUNS_PL;
Cmnd->cmd_len = 12;
Cmnd->channel = pLoggedInPort->ScsiNexus.channel;
Cmnd->target = pLoggedInPort->ScsiNexus.target;
Cmnd->device->channel = pLoggedInPort->ScsiNexus.channel;
Cmnd->device->id = pLoggedInPort->ScsiNexus.target;
ulStatus = cpqfcTSBuildExchange(
......@@ -3003,6 +3008,10 @@ static void IssueReportLunsCommand(
Done:
if (Cmnd)
scsi_put_command (Cmnd);
if (ScsiDev)
scsi_free_host_dev (ScsiDev);
}
......@@ -3361,22 +3370,22 @@ PFC_LOGGEDIN_PORT fcFindLoggedInPort(
{
// check Linux Scsi Cmnd for channel/target Nexus match
// (all luns are accessed through matching "pLoggedInPort")
if( (pLoggedInPort->ScsiNexus.target == Cmnd->target)
if( (pLoggedInPort->ScsiNexus.target == Cmnd->device->id)
&&
(pLoggedInPort->ScsiNexus.channel == Cmnd->channel))
(pLoggedInPort->ScsiNexus.channel == Cmnd->device->channel))
{
// For "passthru" modes, the IOCTL caller is responsible
// for setting the FCP-LUN addressing
if (Cmnd->sc_request != NULL && Cmnd->host != NULL &&
Cmnd->host->hostdata != NULL &&
is_private_data_of_cpqfc((CPQFCHBA *) Cmnd->host->hostdata,
if (Cmnd->sc_request != NULL && Cmnd->device->host != NULL &&
Cmnd->device->host->hostdata != NULL &&
is_private_data_of_cpqfc((CPQFCHBA *) Cmnd->device->host->hostdata,
Cmnd->sc_request->upper_private_data)) {
/* This is a passthru... */
cpqfc_passthru_private_t *pd;
pd = Cmnd->sc_request->upper_private_data;
Cmnd->SCp.phase = pd->bus;
// Cmnd->SCp.have_data_in = pd->pdrive;
Cmnd->SCp.have_data_in = Cmnd->lun;
Cmnd->SCp.have_data_in = Cmnd->device->lun;
} else {
/* This is not a passthru... */
......@@ -3391,17 +3400,17 @@ PFC_LOGGEDIN_PORT fcFindLoggedInPort(
// Report Luns command
if( pLoggedInPort->ScsiNexus.LunMasking == 1)
{
if (Cmnd->lun > sizeof(pLoggedInPort->ScsiNexus.lun))
if (Cmnd->device->lun > sizeof(pLoggedInPort->ScsiNexus.lun))
return NULL;
// we KNOW all the valid LUNs... 0xFF is invalid!
Cmnd->SCp.have_data_in = pLoggedInPort->ScsiNexus.lun[Cmnd->lun];
if (pLoggedInPort->ScsiNexus.lun[Cmnd->lun] == 0xFF)
Cmnd->SCp.have_data_in = pLoggedInPort->ScsiNexus.lun[Cmnd->device->lun];
if (pLoggedInPort->ScsiNexus.lun[Cmnd->device->lun] == 0xFF)
return NULL;
// printk("xlating lun %d to 0x%02x\n", Cmnd->lun,
// pLoggedInPort->ScsiNexus.lun[Cmnd->lun]);
}
else
Cmnd->SCp.have_data_in = Cmnd->lun; // Linux & target luns match
Cmnd->SCp.have_data_in = Cmnd->device->lun; // Linux & target luns match
}
break; // found it!
}
......@@ -3507,9 +3516,9 @@ static void UnblockScsiDevice( struct Scsi_Host *HostAdapter,
// Are there any Q'd commands for this target?
if( (Cmnd->target == pLoggedInPort->ScsiNexus.target)
if( (Cmnd->device->id == pLoggedInPort->ScsiNexus.target)
&&
(Cmnd->channel == pLoggedInPort->ScsiNexus.channel) )
(Cmnd->device->channel == pLoggedInPort->ScsiNexus.channel) )
{
Cmnd->result = (DID_SOFT_ERROR <<16); // force retry
if( Cmnd->scsi_done == NULL)
......
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