Commit be997811 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[PATCH] aacraid updates for new probing APIs

On Wed, Nov 19, 2003 at 12:48:28PM +0000, Christoph Hellwig wrote:
> On Tue, Nov 18, 2003 at 01:29:22PM -0800, Mark Haverkamp wrote:
> > > +	pci_set_master(pdev);
> > > +	pci_set_dma_mask(pdev, 0xFFFFFFFFULL);
> >
> > I've been told that the return value of this should be checked as it is
> > possible for it to fail.
>
> Indeed.  This patches objective was to convert aacraid to the new-style
> probing, not to fix bugs, but I'll add the fix to the next revision of
> the patch anyway.

Ok here's a new patch.  Updates:

  - check pci_set_dma_mask return value
  - fix leak in the HBA remove path
  - fix leak in probe_one failure case
  - remove unused list of hosts
  - avoid scsi.h usage all over driver
  - mention the updates in the README file
parent 9cd56c73
...@@ -28,7 +28,8 @@ Supported Cards/Chipsets ...@@ -28,7 +28,8 @@ Supported Cards/Chipsets
People People
------------------------- -------------------------
Alan Cox <alan@redhat.com> Alan Cox <alan@redhat.com>
Christoph Hellwig <hch@infradead.org> (small cleanups/fixes) Christoph Hellwig <hch@infradead.org> (updates for new-style PCI probing and SCSI host registration,
small cleanups/fixes)
Matt Domsch <matt_domsch@dell.com> (revision ioctl, adapter messages) Matt Domsch <matt_domsch@dell.com> (revision ioctl, adapter messages)
Deanna Bonds <deanna_bonds@adaptec.com> (non-DASD support, PAE fibs and 64 bit, added new adaptec controllers Deanna Bonds <deanna_bonds@adaptec.com> (non-DASD support, PAE fibs and 64 bit, added new adaptec controllers
added new ioctls, changed scsi interface to use new error handler, added new ioctls, changed scsi interface to use new error handler,
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* *
* based on the old aacraid driver that is.. * based on the old aacraid driver that is..
* Adaptec aacraid device driver for Linux. * Adaptec aacraid device driver for Linux.
*
* Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -22,7 +23,6 @@ ...@@ -22,7 +23,6 @@
* *
*/ */
#include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -31,11 +31,14 @@ ...@@ -31,11 +31,14 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/blkdev.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/blkdev.h>
#include "scsi.h" #include <scsi/scsi.h>
#include "hosts.h" #include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include "aacraid.h" #include "aacraid.h"
...@@ -194,9 +197,9 @@ struct sense_data { ...@@ -194,9 +197,9 @@ struct sense_data {
static struct fsa_scsi_hba *fsa_dev[MAXIMUM_NUM_ADAPTERS]; /* SCSI Device Instance Pointers */ static struct fsa_scsi_hba *fsa_dev[MAXIMUM_NUM_ADAPTERS]; /* SCSI Device Instance Pointers */
static struct sense_data sense_data[MAXIMUM_NUM_CONTAINERS]; static struct sense_data sense_data[MAXIMUM_NUM_CONTAINERS];
static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* sgmap); static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap);
static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg); static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg);
static int aac_send_srb_fib(Scsi_Cmnd* scsicmd); static int aac_send_srb_fib(struct scsi_cmnd* scsicmd);
#ifdef AAC_DETAILED_STATUS_INFO #ifdef AAC_DETAILED_STATUS_INFO
static char *aac_get_status_string(u32 status); static char *aac_get_status_string(u32 status);
#endif #endif
...@@ -444,7 +447,7 @@ void set_sense(u8 *sense_buf, u8 sense_key, u8 sense_code, ...@@ -444,7 +447,7 @@ void set_sense(u8 *sense_buf, u8 sense_key, u8 sense_code,
} }
} }
static void aac_io_done(Scsi_Cmnd * scsicmd) static void aac_io_done(struct scsi_cmnd * scsicmd)
{ {
unsigned long cpu_flags; unsigned long cpu_flags;
struct Scsi_Host *host = scsicmd->device->host; struct Scsi_Host *host = scsicmd->device->host;
...@@ -453,7 +456,7 @@ static void aac_io_done(Scsi_Cmnd * scsicmd) ...@@ -453,7 +456,7 @@ static void aac_io_done(Scsi_Cmnd * scsicmd)
spin_unlock_irqrestore(host->host_lock, cpu_flags); spin_unlock_irqrestore(host->host_lock, cpu_flags);
} }
static void __aac_io_done(Scsi_Cmnd * scsicmd) static void __aac_io_done(struct scsi_cmnd * scsicmd)
{ {
scsicmd->scsi_done(scsicmd); scsicmd->scsi_done(scsicmd);
} }
...@@ -538,11 +541,11 @@ static void read_callback(void *context, struct fib * fibptr) ...@@ -538,11 +541,11 @@ static void read_callback(void *context, struct fib * fibptr)
{ {
struct aac_dev *dev; struct aac_dev *dev;
struct aac_read_reply *readreply; struct aac_read_reply *readreply;
Scsi_Cmnd *scsicmd; struct scsi_cmnd *scsicmd;
u32 lba; u32 lba;
u32 cid; u32 cid;
scsicmd = (Scsi_Cmnd *) context; scsicmd = (struct scsi_cmnd *) context;
dev = (struct aac_dev *)scsicmd->device->host->hostdata; dev = (struct aac_dev *)scsicmd->device->host->hostdata;
cid =TARGET_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); cid =TARGET_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
...@@ -557,11 +560,11 @@ static void read_callback(void *context, struct fib * fibptr) ...@@ -557,11 +560,11 @@ static void read_callback(void *context, struct fib * fibptr)
pci_unmap_sg(dev->pdev, pci_unmap_sg(dev->pdev,
(struct scatterlist *)scsicmd->buffer, (struct scatterlist *)scsicmd->buffer,
scsicmd->use_sg, scsicmd->use_sg,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction)); scsicmd->sc_data_direction);
else if(scsicmd->request_bufflen) else if(scsicmd->request_bufflen)
pci_unmap_single(dev->pdev, (dma_addr_t)(ulong)scsicmd->SCp.ptr, pci_unmap_single(dev->pdev, (dma_addr_t)(ulong)scsicmd->SCp.ptr,
scsicmd->request_bufflen, scsicmd->request_bufflen,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction)); scsicmd->sc_data_direction);
readreply = (struct aac_read_reply *)fib_data(fibptr); readreply = (struct aac_read_reply *)fib_data(fibptr);
if (le32_to_cpu(readreply->status) == ST_OK) if (le32_to_cpu(readreply->status) == ST_OK)
scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
...@@ -584,11 +587,11 @@ static void write_callback(void *context, struct fib * fibptr) ...@@ -584,11 +587,11 @@ static void write_callback(void *context, struct fib * fibptr)
{ {
struct aac_dev *dev; struct aac_dev *dev;
struct aac_write_reply *writereply; struct aac_write_reply *writereply;
Scsi_Cmnd *scsicmd; struct scsi_cmnd *scsicmd;
u32 lba; u32 lba;
u32 cid; u32 cid;
scsicmd = (Scsi_Cmnd *) context; scsicmd = (struct scsi_cmnd *) context;
dev = (struct aac_dev *)scsicmd->device->host->hostdata; dev = (struct aac_dev *)scsicmd->device->host->hostdata;
cid = TARGET_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); cid = TARGET_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
...@@ -601,11 +604,11 @@ static void write_callback(void *context, struct fib * fibptr) ...@@ -601,11 +604,11 @@ static void write_callback(void *context, struct fib * fibptr)
pci_unmap_sg(dev->pdev, pci_unmap_sg(dev->pdev,
(struct scatterlist *)scsicmd->buffer, (struct scatterlist *)scsicmd->buffer,
scsicmd->use_sg, scsicmd->use_sg,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction)); scsicmd->sc_data_direction);
else if(scsicmd->request_bufflen) else if(scsicmd->request_bufflen)
pci_unmap_single(dev->pdev, (dma_addr_t)(ulong)scsicmd->SCp.ptr, pci_unmap_single(dev->pdev, (dma_addr_t)(ulong)scsicmd->SCp.ptr,
scsicmd->request_bufflen, scsicmd->request_bufflen,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction)); scsicmd->sc_data_direction);
writereply = (struct aac_write_reply *) fib_data(fibptr); writereply = (struct aac_write_reply *) fib_data(fibptr);
if (le32_to_cpu(writereply->status) == ST_OK) if (le32_to_cpu(writereply->status) == ST_OK)
...@@ -625,7 +628,7 @@ static void write_callback(void *context, struct fib * fibptr) ...@@ -625,7 +628,7 @@ static void write_callback(void *context, struct fib * fibptr)
aac_io_done(scsicmd); aac_io_done(scsicmd);
} }
int aac_read(Scsi_Cmnd * scsicmd, int cid) int aac_read(struct scsi_cmnd * scsicmd, int cid)
{ {
u32 lba; u32 lba;
u32 count; u32 count;
...@@ -736,7 +739,7 @@ int aac_read(Scsi_Cmnd * scsicmd, int cid) ...@@ -736,7 +739,7 @@ int aac_read(Scsi_Cmnd * scsicmd, int cid)
return -1; return -1;
} }
static int aac_write(Scsi_Cmnd * scsicmd, int cid) static int aac_write(struct scsi_cmnd * scsicmd, int cid)
{ {
u32 lba; u32 lba;
u32 count; u32 count;
...@@ -853,7 +856,7 @@ static int aac_write(Scsi_Cmnd * scsicmd, int cid) ...@@ -853,7 +856,7 @@ static int aac_write(Scsi_Cmnd * scsicmd, int cid)
* aacraid firmware. * aacraid firmware.
*/ */
int aac_scsi_cmd(Scsi_Cmnd * scsicmd) int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
{ {
u32 cid = 0; u32 cid = 0;
struct fsa_scsi_hba *fsa_dev_ptr; struct fsa_scsi_hba *fsa_dev_ptr;
...@@ -1215,9 +1218,9 @@ static void aac_srb_callback(void *context, struct fib * fibptr) ...@@ -1215,9 +1218,9 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
{ {
struct aac_dev *dev; struct aac_dev *dev;
struct aac_srb_reply *srbreply; struct aac_srb_reply *srbreply;
Scsi_Cmnd *scsicmd; struct scsi_cmnd *scsicmd;
scsicmd = (Scsi_Cmnd *) context; scsicmd = (struct scsi_cmnd *) context;
dev = (struct aac_dev *)scsicmd->device->host->hostdata; dev = (struct aac_dev *)scsicmd->device->host->hostdata;
if (fibptr == NULL) if (fibptr == NULL)
...@@ -1233,10 +1236,10 @@ static void aac_srb_callback(void *context, struct fib * fibptr) ...@@ -1233,10 +1236,10 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
pci_unmap_sg(dev->pdev, pci_unmap_sg(dev->pdev,
(struct scatterlist *)scsicmd->buffer, (struct scatterlist *)scsicmd->buffer,
scsicmd->use_sg, scsicmd->use_sg,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction)); scsicmd->sc_data_direction);
else if(scsicmd->request_bufflen) else if(scsicmd->request_bufflen)
pci_unmap_single(dev->pdev, (ulong)scsicmd->SCp.ptr, scsicmd->request_bufflen, pci_unmap_single(dev->pdev, (ulong)scsicmd->SCp.ptr, scsicmd->request_bufflen,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction)); scsicmd->sc_data_direction);
/* /*
* First check the fib status * First check the fib status
...@@ -1396,7 +1399,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) ...@@ -1396,7 +1399,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
* scsicmd passed in. * scsicmd passed in.
*/ */
static int aac_send_srb_fib(Scsi_Cmnd* scsicmd) static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
{ {
struct fib* cmd_fibcontext; struct fib* cmd_fibcontext;
struct aac_dev* dev; struct aac_dev* dev;
...@@ -1414,17 +1417,16 @@ static int aac_send_srb_fib(Scsi_Cmnd* scsicmd) ...@@ -1414,17 +1417,16 @@ static int aac_send_srb_fib(Scsi_Cmnd* scsicmd)
dev = (struct aac_dev *)scsicmd->device->host->hostdata; dev = (struct aac_dev *)scsicmd->device->host->hostdata;
switch(scsicmd->sc_data_direction){ switch(scsicmd->sc_data_direction){
case SCSI_DATA_WRITE: case DMA_TO_DEVICE:
flag = SRB_DataOut; flag = SRB_DataOut;
break; break;
case SCSI_DATA_UNKNOWN: case DMA_BIDIRECTIONAL:
flag = SRB_DataIn | SRB_DataOut; flag = SRB_DataIn | SRB_DataOut;
break; break;
case SCSI_DATA_READ: case DMA_FROM_DEVICE:
flag = SRB_DataIn; flag = SRB_DataIn;
break; break;
case SCSI_DATA_NONE: case DMA_NONE:
default:
flag = SRB_NoDataXfer; flag = SRB_NoDataXfer;
break; break;
} }
...@@ -1507,7 +1509,7 @@ static int aac_send_srb_fib(Scsi_Cmnd* scsicmd) ...@@ -1507,7 +1509,7 @@ static int aac_send_srb_fib(Scsi_Cmnd* scsicmd)
return -1; return -1;
} }
static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* psg) static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* psg)
{ {
struct aac_dev *dev; struct aac_dev *dev;
unsigned long byte_count = 0; unsigned long byte_count = 0;
...@@ -1524,7 +1526,7 @@ static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* psg) ...@@ -1524,7 +1526,7 @@ static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* psg)
sg = (struct scatterlist *) scsicmd->request_buffer; sg = (struct scatterlist *) scsicmd->request_buffer;
sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg, sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction)); scsicmd->sc_data_direction);
psg->count = cpu_to_le32(sg_count); psg->count = cpu_to_le32(sg_count);
byte_count = 0; byte_count = 0;
...@@ -1551,7 +1553,7 @@ static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* psg) ...@@ -1551,7 +1553,7 @@ static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* psg)
addr = pci_map_single(dev->pdev, addr = pci_map_single(dev->pdev,
scsicmd->request_buffer, scsicmd->request_buffer,
scsicmd->request_bufflen, scsicmd->request_bufflen,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction)); scsicmd->sc_data_direction);
psg->count = cpu_to_le32(1); psg->count = cpu_to_le32(1);
psg->sg[0].addr = cpu_to_le32(addr); psg->sg[0].addr = cpu_to_le32(addr);
psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen);
...@@ -1562,7 +1564,7 @@ static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* psg) ...@@ -1562,7 +1564,7 @@ static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* psg)
} }
static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg) static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg)
{ {
struct aac_dev *dev; struct aac_dev *dev;
unsigned long byte_count = 0; unsigned long byte_count = 0;
...@@ -1581,7 +1583,7 @@ static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg) ...@@ -1581,7 +1583,7 @@ static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg)
sg = (struct scatterlist *) scsicmd->request_buffer; sg = (struct scatterlist *) scsicmd->request_buffer;
sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg, sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction)); scsicmd->sc_data_direction);
psg->count = cpu_to_le32(sg_count); psg->count = cpu_to_le32(sg_count);
byte_count = 0; byte_count = 0;
...@@ -1610,7 +1612,7 @@ static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg) ...@@ -1610,7 +1612,7 @@ static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg)
addr = pci_map_single(dev->pdev, addr = pci_map_single(dev->pdev,
scsicmd->request_buffer, scsicmd->request_buffer,
scsicmd->request_bufflen, scsicmd->request_bufflen,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction)); scsicmd->sc_data_direction);
psg->count = cpu_to_le32(1); psg->count = cpu_to_le32(1);
le_addr = cpu_to_le64(addr); le_addr = cpu_to_le64(addr);
psg->sg[0].addr[1] = (u32)(le_addr>>32); psg->sg[0].addr[1] = (u32)(le_addr>>32);
......
...@@ -520,10 +520,6 @@ struct adapter_ops ...@@ -520,10 +520,6 @@ struct adapter_ops
struct aac_driver_ident struct aac_driver_ident
{ {
u16 vendor;
u16 device;
u16 subsystem_vendor;
u16 subsystem_device;
int (*init)(struct aac_dev *dev, unsigned long num); int (*init)(struct aac_dev *dev, unsigned long num);
char * name; char * name;
char * vname; char * vname;
...@@ -1466,6 +1462,8 @@ static inline u32 cap_to_cyls(sector_t capacity, u32 divisor) ...@@ -1466,6 +1462,8 @@ static inline u32 cap_to_cyls(sector_t capacity, u32 divisor)
return (u32)capacity; return (u32)capacity;
} }
struct scsi_cmnd;
const char *aac_driverinfo(struct Scsi_Host *); const char *aac_driverinfo(struct Scsi_Host *);
struct fib *fib_alloc(struct aac_dev *dev); struct fib *fib_alloc(struct aac_dev *dev);
int fib_setup(struct aac_dev *dev); int fib_setup(struct aac_dev *dev);
...@@ -1480,10 +1478,9 @@ int aac_consumer_avail(struct aac_dev * dev, struct aac_queue * q); ...@@ -1480,10 +1478,9 @@ int aac_consumer_avail(struct aac_dev * dev, struct aac_queue * q);
void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum); void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum);
int fib_complete(struct fib * context); int fib_complete(struct fib * context);
#define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data) #define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data)
int aac_detach(struct aac_dev *dev);
struct aac_dev *aac_init_adapter(struct aac_dev *dev); struct aac_dev *aac_init_adapter(struct aac_dev *dev);
int aac_get_containers(struct aac_dev *dev); int aac_get_containers(struct aac_dev *dev);
int aac_scsi_cmd(Scsi_Cmnd *scsi_cmnd_ptr); int aac_scsi_cmd(struct scsi_cmnd *cmd);
int aac_dev_ioctl(struct aac_dev *dev, int cmd, void *arg); int aac_dev_ioctl(struct aac_dev *dev, int cmd, void *arg);
int aac_do_ioctl(struct aac_dev * dev, int cmd, void *arg); int aac_do_ioctl(struct aac_dev * dev, int cmd, void *arg);
int aac_rx_init(struct aac_dev *dev, unsigned long devNumber); int aac_rx_init(struct aac_dev *dev, unsigned long devNumber);
...@@ -1495,3 +1492,4 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context *fibctx); ...@@ -1495,3 +1492,4 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context *fibctx);
int fib_adapter_complete(struct fib * fibptr, unsigned short size); int fib_adapter_complete(struct fib * fibptr, unsigned short size);
struct aac_driver_ident* aac_get_driver_ident(int devtype); struct aac_driver_ident* aac_get_driver_ident(int devtype);
int aac_get_adapter_info(struct aac_dev* dev); int aac_get_adapter_info(struct aac_dev* dev);
int aac_send_shutdown(struct aac_dev *dev);
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
* *
*/ */
#include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -37,11 +36,10 @@ ...@@ -37,11 +36,10 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/dma-mapping.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "scsi.h"
#include "hosts.h"
#include "aacraid.h" #include "aacraid.h"
...@@ -439,16 +437,16 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg) ...@@ -439,16 +437,16 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg)
switch(srbcmd->flags){ switch(srbcmd->flags){
case SRB_DataOut: case SRB_DataOut:
data_dir = SCSI_DATA_WRITE; data_dir = DMA_TO_DEVICE;
break; break;
case (SRB_DataIn | SRB_DataOut): case (SRB_DataIn | SRB_DataOut):
data_dir = SCSI_DATA_UNKNOWN; data_dir = DMA_BIDIRECTIONAL;
break; break;
case SRB_DataIn: case SRB_DataIn:
data_dir = SCSI_DATA_READ; data_dir = DMA_FROM_DEVICE;
break; break;
default: default:
data_dir = SCSI_DATA_NONE; data_dir = DMA_NONE;
} }
if( dev->pae_support ==1 ) { if( dev->pae_support ==1 ) {
struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg; struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg;
...@@ -484,7 +482,7 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg) ...@@ -484,7 +482,7 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg)
goto cleanup; goto cleanup;
} }
} }
addr = pci_map_single(dev->pdev, p, psg->sg[i].count, scsi_to_pci_dma_dir(data_dir)); addr = pci_map_single(dev->pdev, p, psg->sg[i].count, data_dir);
le_addr = cpu_to_le64(addr); le_addr = cpu_to_le64(addr);
psg->sg[i].addr[1] = (u32)(le_addr>>32); psg->sg[i].addr[1] = (u32)(le_addr>>32);
...@@ -526,7 +524,7 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg) ...@@ -526,7 +524,7 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg)
goto cleanup; goto cleanup;
} }
} }
addr = pci_map_single(dev->pdev, p, psg->sg[i].count, scsi_to_pci_dma_dir(data_dir)); addr = pci_map_single(dev->pdev, p, psg->sg[i].count, data_dir);
psg->sg[i].addr = cpu_to_le32(addr); psg->sg[i].addr = cpu_to_le32(addr);
psg->sg[i].count = cpu_to_le32(psg->sg[i].count); psg->sg[i].count = cpu_to_le32(psg->sg[i].count);
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
* *
*/ */
#include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -41,15 +40,11 @@ ...@@ -41,15 +40,11 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include "scsi.h"
#include "hosts.h"
#include "aacraid.h" #include "aacraid.h"
struct aac_common aac_config; struct aac_common aac_config;
static struct aac_dev *devices;
static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long commsize, unsigned long commalign) static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long commsize, unsigned long commalign)
{ {
unsigned char *base; unsigned char *base;
...@@ -163,7 +158,7 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem, ...@@ -163,7 +158,7 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem,
* This routine will send a VM_CloseAll (shutdown) request to the adapter. * This routine will send a VM_CloseAll (shutdown) request to the adapter.
*/ */
static int aac_send_shutdown(struct aac_dev * dev) int aac_send_shutdown(struct aac_dev * dev)
{ {
struct fib * fibctx; struct fib * fibctx;
struct aac_close *cmd; struct aac_close *cmd;
...@@ -190,35 +185,6 @@ static int aac_send_shutdown(struct aac_dev * dev) ...@@ -190,35 +185,6 @@ static int aac_send_shutdown(struct aac_dev * dev)
return status; return status;
} }
/**
* aac_detach - detach adapter
* @detach: adapter to disconnect
*
* Disconnect and shutdown an AAC based adapter, freeing resources
* as we go.
*/
int aac_detach(struct aac_dev *detach)
{
struct aac_dev **dev = &devices;
while(*dev)
{
if(*dev == detach)
{
*dev = detach->next;
aac_send_shutdown(detach);
fib_map_free(detach);
pci_free_consistent(detach->pdev, detach->comm_size, detach->comm_addr, detach->comm_phys);
kfree(detach->queues);
return 1;
}
dev=&((*dev)->next);
}
BUG();
return 0;
}
/** /**
* aac_comm_init - Initialise FSA data structures * aac_comm_init - Initialise FSA data structures
* @dev: Adapter to initialise * @dev: Adapter to initialise
...@@ -344,11 +310,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) ...@@ -344,11 +310,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
INIT_LIST_HEAD(&dev->fib_list); INIT_LIST_HEAD(&dev->fib_list);
init_completion(&dev->aif_completion); init_completion(&dev->aif_completion);
/*
* Add this adapter in to our dev List.
*/
dev->next = devices;
devices = dev;
return dev; return dev;
} }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
* (c) Copyright 2001 Red Hat Inc. <alan@redhat.com> * (c) Copyright 2001 Red Hat Inc. <alan@redhat.com>
* *
* based on the old aacraid driver that is.. * based on the old aacraid driver that is..
* Adaptec aacraid device driver for Linux. * Adaptec aacraid device driver for Linux.
* *
* Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com)
...@@ -28,10 +27,8 @@ ...@@ -28,10 +27,8 @@
* Abstract: Contain all routines that are required for FSA host/adapter * Abstract: Contain all routines that are required for FSA host/adapter
* commuication. * commuication.
* *
*
*/ */
#include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -40,10 +37,8 @@ ...@@ -40,10 +37,8 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <asm/semaphore.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include "scsi.h" #include <asm/semaphore.h>
#include "hosts.h"
#include "aacraid.h" #include "aacraid.h"
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
* *
*/ */
#include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -40,8 +39,6 @@ ...@@ -40,8 +39,6 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include "scsi.h"
#include "hosts.h"
#include "aacraid.h" #include "aacraid.h"
......
This diff is collapsed.
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
* *
*/ */
#include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -41,8 +40,8 @@ ...@@ -41,8 +40,8 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include "scsi.h"
#include "hosts.h" #include <scsi/scsi_host.h>
#include "aacraid.h" #include "aacraid.h"
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
* *
*/ */
#include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -41,8 +40,8 @@ ...@@ -41,8 +40,8 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include "scsi.h"
#include "hosts.h" #include <scsi/scsi_host.h>
#include "aacraid.h" #include "aacraid.h"
......
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