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