Commit 3f642845 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

Update aacraid from 2.4->2.5 semantics

- stanford checker fixes (randy.dunlap)
- updated io_request_lock to correct 2.5 lock
- spelling fixes
- torvalds daemonize changes
- updated templates etc
- update scsicmd-> to scsicmd->device-> for new command alloc code
- update biosparam and add slave_configure
- gendisk name changes
- fix compile warnings
parent afd7d9c5
# Adaptec aacraid
EXTRA_CFLAGS += -I$(TOPDIR)/drivers/scsi
obj-$(CONFIG_SCSI_AACRAID) := aacraid.o
O_TARGET := aacraid.o
obj-m := $(O_TARGET)
obj-y := linit.o aachba.o commctrl.o comminit.o commsup.o \
aacraid-objs := linit.o aachba.o commctrl.o comminit.o commsup.o \
dpcsup.o rx.o sa.o
include $(TOPDIR)/Rules.make
EXTRA_CFLAGS := -Idrivers/scsi
......@@ -37,7 +37,6 @@
#include <linux/blk.h>
#include "scsi.h"
#include "hosts.h"
#include "sd.h"
#include "aacraid.h"
......@@ -215,7 +214,6 @@ struct sense_data {
static struct fsa_scsi_hba *fsa_dev[MAXIMUM_NUM_ADAPTERS]; /* SCSI Device Instance Pointers */
static struct sense_data sense_data[MAXIMUM_NUM_CONTAINERS];
static void get_sd_devname(int disknum, char *buffer);
static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* sgmap);
static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg);
static int aac_send_srb_fib(Scsi_Cmnd* scsicmd);
......@@ -397,8 +395,8 @@ static char *container_types[] = {
* Arguments: [1] pointer to void [1] int
*
* Purpose: Sets SCSI inquiry data strings for vendor, product
* and revision level. Allows strings to be set in platform dependant
* files instead of in OS dependant driver source.
* and revision level. Allows strings to be set in platform dependent
* files instead of in OS dependent driver source.
*/
static void setinqstr(int devtype, void *data, int tindex)
......@@ -468,9 +466,9 @@ void set_sense(u8 *sense_buf, u8 sense_key, u8 sense_code,
static void aac_io_done(Scsi_Cmnd * scsicmd)
{
unsigned long cpu_flags;
spin_lock_irqsave(&io_request_lock, cpu_flags);
spin_lock_irqsave(scsicmd->device->host->host_lock, cpu_flags);
scsicmd->scsi_done(scsicmd);
spin_unlock_irqrestore(&io_request_lock, cpu_flags);
spin_unlock_irqrestore(scsicmd->device->host->host_lock, cpu_flags);
}
static void __aac_io_done(Scsi_Cmnd * scsicmd)
......@@ -564,8 +562,8 @@ static void read_callback(void *context, struct fib * fibptr)
scsicmd = (Scsi_Cmnd *) context;
dev = (struct aac_dev *)scsicmd->host->hostdata;
cid =TARGET_LUN_TO_CONTAINER(scsicmd->target, scsicmd->lun);
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
cid =TARGET_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
dprintk((KERN_DEBUG "read_callback[cpu %d]: lba = %u, t = %ld.\n", smp_processor_id(), lba, jiffies));
......@@ -609,8 +607,8 @@ static void write_callback(void *context, struct fib * fibptr)
u32 cid;
scsicmd = (Scsi_Cmnd *) context;
dev = (struct aac_dev *)scsicmd->host->hostdata;
cid = TARGET_LUN_TO_CONTAINER(scsicmd->target, scsicmd->lun);
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
cid = TARGET_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
dprintk((KERN_DEBUG "write_callback[cpu %d]: lba = %u, t = %ld.\n", smp_processor_id(), lba, jiffies));
......@@ -655,7 +653,7 @@ int aac_read(Scsi_Cmnd * scsicmd, int cid)
struct aac_dev *dev;
struct fib * cmd_fibcontext;
dev = (struct aac_dev *)scsicmd->host->hostdata;
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
/*
* Get block address and transfer length
*/
......@@ -765,7 +763,7 @@ static int aac_write(Scsi_Cmnd * scsicmd, int cid)
struct aac_dev *dev;
struct fib * cmd_fibcontext;
dev = (struct aac_dev *)scsicmd->host->hostdata;
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
/*
* Get block address and transfer length
*/
......@@ -879,25 +877,25 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
struct fsa_scsi_hba *fsa_dev_ptr;
int cardtype;
int ret;
struct aac_dev *dev = (struct aac_dev *)scsicmd->host->hostdata;
struct aac_dev *dev = (struct aac_dev *)scsicmd->device->host->hostdata;
cardtype = dev->cardtype;
fsa_dev_ptr = fsa_dev[scsicmd->host->unique_id];
fsa_dev_ptr = fsa_dev[scsicmd->device->host->unique_id];
/*
* If the bus, target or lun is out of range, return fail
* Test does not apply to ID 16, the pseudo id for the controller
* itself.
*/
if (scsicmd->target != scsicmd->host->this_id) {
if ((scsicmd->channel == 0) ){
if( (scsicmd->target >= AAC_MAX_TARGET) || (scsicmd->lun != 0)){
if (scsicmd->device->id != scsicmd->device->host->this_id) {
if ((scsicmd->device->channel == 0) ){
if( (scsicmd->device->id >= AAC_MAX_TARGET) || (scsicmd->device->lun != 0)){
scsicmd->result = DID_NO_CONNECT << 16;
__aac_io_done(scsicmd);
return 0;
}
cid = TARGET_LUN_TO_CONTAINER(scsicmd->target, scsicmd->lun);
cid = TARGET_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
/*
* If the target container doesn't exist, it may have
......@@ -908,9 +906,9 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
case SS_INQUIR:
case SS_RDCAP:
case SS_TEST:
spin_unlock_irq(&io_request_lock);
spin_unlock_irq(scsicmd->device->host->host_lock);
probe_container(dev, cid);
spin_lock_irq(&io_request_lock);
spin_lock_irq(scsicmd->device->host->host_lock);
if (fsa_dev_ptr->valid[cid] == 0) {
scsicmd->result = DID_NO_CONNECT << 16;
__aac_io_done(scsicmd);
......@@ -962,7 +960,7 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
{
struct inquiry_data *inq_data_ptr;
dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scsicmd->target));
dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scsicmd->device->id));
inq_data_ptr = (struct inquiry_data *)scsicmd->request_buffer;
memset(inq_data_ptr, 0, sizeof (struct inquiry_data));
......@@ -979,7 +977,7 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
* see: <vendor>.c i.e. aac.c
*/
setinqstr(cardtype, (void *) (inq_data_ptr->inqd_vid), fsa_dev_ptr->type[cid]);
if (scsicmd->target == scsicmd->host->this_id)
if (scsicmd->device->id == scsicmd->device->host->this_id)
inq_data_ptr->inqd_pdt = INQD_PDT_PROC; /* Processor device */
else
inq_data_ptr->inqd_pdt = INQD_PDT_DA; /* Direct/random access device */
......@@ -1073,17 +1071,21 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
* containers to /dev/sd device names
*/
spin_unlock_irq(&io_request_lock);
fsa_dev_ptr->devno[cid] = DEVICE_NR(scsicmd->request.rq_dev);
spin_unlock_irq(scsicmd->device->host->host_lock);
if (scsicmd->request->rq_disk)
memcpy(fsa_dev_ptr->devname[cid],
scsicmd->request->rq_disk->disk_name,
8);
ret = aac_read(scsicmd, cid);
spin_lock_irq(&io_request_lock);
spin_lock_irq(scsicmd->device->host->host_lock);
return ret;
case SS_WRITE:
case SM_WRITE:
spin_unlock_irq(&io_request_lock);
spin_unlock_irq(scsicmd->device->host->host_lock);
ret = aac_write(scsicmd, cid);
spin_lock_irq(&io_request_lock);
spin_lock_irq(scsicmd->device->host->host_lock);
return ret;
default:
/*
......@@ -1111,7 +1113,7 @@ static int query_disk(struct aac_dev *dev, void *arg)
qd.cnum = TARGET_LUN_TO_CONTAINER(qd.target, qd.lun);
else if ((qd.bus == -1) && (qd.target == -1) && (qd.lun == -1))
{
if (qd.cnum < 0 || qd.cnum > MAXIMUM_NUM_CONTAINERS)
if (qd.cnum < 0 || qd.cnum >= MAXIMUM_NUM_CONTAINERS)
return -EINVAL;
qd.instance = dev->scsi_host_ptr->host_no;
qd.bus = 0;
......@@ -1124,40 +1126,18 @@ static int query_disk(struct aac_dev *dev, void *arg)
qd.locked = fsa_dev_ptr->locked[qd.cnum];
qd.deleted = fsa_dev_ptr->deleted[qd.cnum];
if (fsa_dev_ptr->devno[qd.cnum] == -1)
if (fsa_dev_ptr->devname[qd.cnum][0] == '\0')
qd.unmapped = 1;
else
qd.unmapped = 0;
get_sd_devname(fsa_dev_ptr->devno[qd.cnum], qd.name);
strncpy(qd.name, fsa_dev_ptr->devname[qd.cnum], 8);
if (copy_to_user(arg, &qd, sizeof (struct aac_query_disk)))
return -EFAULT;
return 0;
}
static void get_sd_devname(int disknum, char *buffer)
{
if (disknum < 0) {
sprintf(buffer, "%s", "");
return;
}
if (disknum < 26)
sprintf(buffer, "sd%c", 'a' + disknum);
else {
unsigned int min1;
unsigned int min2;
/*
* For larger numbers of disks, we need to go to a new
* naming scheme.
*/
min1 = disknum / 26;
min2 = disknum % 26;
sprintf(buffer, "sd%c%c", 'a' + min1 - 1, 'a' + min2);
}
}
static int force_delete_disk(struct aac_dev *dev, void *arg)
{
struct aac_delete_disk dd;
......@@ -1168,7 +1148,7 @@ static int force_delete_disk(struct aac_dev *dev, void *arg)
if (copy_from_user(&dd, arg, sizeof (struct aac_delete_disk)))
return -EFAULT;
if (dd.cnum > MAXIMUM_NUM_CONTAINERS)
if (dd.cnum >= MAXIMUM_NUM_CONTAINERS)
return -EINVAL;
/*
* Mark this container as being deleted.
......@@ -1191,7 +1171,7 @@ static int delete_disk(struct aac_dev *dev, void *arg)
if (copy_from_user(&dd, arg, sizeof (struct aac_delete_disk)))
return -EFAULT;
if (dd.cnum > MAXIMUM_NUM_CONTAINERS)
if (dd.cnum >= MAXIMUM_NUM_CONTAINERS)
return -EINVAL;
/*
* If the container is locked, it can not be deleted by the API.
......@@ -1203,7 +1183,7 @@ static int delete_disk(struct aac_dev *dev, void *arg)
* Mark the container as no longer being valid.
*/
fsa_dev_ptr->valid[dd.cnum] = 0;
fsa_dev_ptr->devno[dd.cnum] = -1;
fsa_dev_ptr->devname[dd.cnum][0] = '\0';
return 0;
}
}
......@@ -1241,7 +1221,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
Scsi_Cmnd *scsicmd;
scsicmd = (Scsi_Cmnd *) context;
dev = (struct aac_dev *)scsicmd->host->hostdata;
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
if (fibptr == NULL)
BUG();
......@@ -1429,13 +1409,13 @@ static int aac_send_srb_fib(Scsi_Cmnd* scsicmd)
u32 flag;
u32 timeout;
if( scsicmd->target > 15 || scsicmd->lun > 7) {
if( scsicmd->device->id > 15 || scsicmd->device->lun > 7) {
scsicmd->result = DID_NO_CONNECT << 16;
__aac_io_done(scsicmd);
return 0;
}
dev = (struct aac_dev *)scsicmd->host->hostdata;
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
switch(scsicmd->sc_data_direction){
case SCSI_DATA_WRITE:
flag = SRB_DataOut;
......@@ -1465,9 +1445,9 @@ static int aac_send_srb_fib(Scsi_Cmnd* scsicmd)
srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext);
srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi);
srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scsicmd->channel));
srbcmd->target = cpu_to_le32(scsicmd->target);
srbcmd->lun = cpu_to_le32(scsicmd->lun);
srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scsicmd->device->channel));
srbcmd->target = cpu_to_le32(scsicmd->device->id);
srbcmd->lun = cpu_to_le32(scsicmd->device->lun);
srbcmd->flags = cpu_to_le32(flag);
timeout = (scsicmd->timeout-jiffies)/HZ;
if(timeout == 0){
......@@ -1535,7 +1515,7 @@ static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* psg)
struct aac_dev *dev;
unsigned long byte_count = 0;
dev = (struct aac_dev *)scsicmd->host->hostdata;
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
// Get rid of old data
psg->count = cpu_to_le32(0);
psg->sg[0].addr = cpu_to_le32(NULL);
......@@ -1578,7 +1558,7 @@ static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* psg)
psg->count = cpu_to_le32(1);
psg->sg[0].addr = cpu_to_le32(addr);
psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen);
scsicmd->SCp.ptr = (void *)addr;
scsicmd->SCp.ptr = (char *)addr;
byte_count = scsicmd->request_bufflen;
}
return byte_count;
......@@ -1591,7 +1571,7 @@ static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg)
unsigned long byte_count = 0;
u64 le_addr;
dev = (struct aac_dev *)scsicmd->host->hostdata;
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
// Get rid of old data
psg->count = cpu_to_le32(0);
psg->sg[0].addr[0] = cpu_to_le32(NULL);
......@@ -1639,7 +1619,7 @@ static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg)
psg->sg[0].addr[1] = (u32)(le_addr>>32);
psg->sg[0].addr[0] = (u32)(le_addr & 0xffffffff);
psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen);
scsicmd->SCp.ptr = (void *)addr;
scsicmd->SCp.ptr = (char *)addr;
byte_count = scsicmd->request_bufflen;
}
return byte_count;
......
......@@ -82,7 +82,7 @@ struct diskparm
/*
* Host side memory scatter gather list
* Used by the adapter for read, write, and readdirplus operations
* We have seperate 32 and 64 bit version because even
* We have separate 32 and 64 bit version because even
* on 64 bit systems not all cards support the 64 bit version
*/
struct sgentry {
......@@ -533,7 +533,7 @@ struct aac_driver_ident
/*
* The adapter interface specs all queues to be located in the same
* physically contigous block. The host structure that defines the
* commuication queues will assume they are each a seperate physically
* commuication queues will assume they are each a separate physically
* contigous memory region that will support them all being one big
* contigous block.
* There is a command and response queue for each level and direction of
......@@ -730,7 +730,7 @@ struct fsa_scsi_hba {
u8 ro[MAXIMUM_NUM_CONTAINERS];
u8 locked[MAXIMUM_NUM_CONTAINERS];
u8 deleted[MAXIMUM_NUM_CONTAINERS];
s32 devno[MAXIMUM_NUM_CONTAINERS];
char devname[MAXIMUM_NUM_CONTAINERS][8];
};
struct fib {
......@@ -1454,6 +1454,21 @@ struct aac_aifcmd {
u8 data[1]; /* Undefined length (from kernel viewpoint) */
};
/**
* Convert capacity to cylinders
* accounting for the fact capacity could be a 64 bit value
*
*/
static inline u32 cap_to_cyls(sector_t capacity, u32 divisor)
{
#ifdef CONFIG_LBD
do_div(capacity, divisor);
#else
capacity /= divisor;
#endif
return (u32) capacity;
}
const char *aac_driverinfo(struct Scsi_Host *);
struct fib *fib_alloc(struct aac_dev *dev);
int fib_setup(struct aac_dev *dev);
......
......@@ -207,7 +207,7 @@ int aac_detach(struct aac_dev *detach)
/**
* aac_comm_init - Initialise FSA data structures
* @dev: Adapter to intialise
* @dev: Adapter to initialise
*
* Initializes the data structures that are required for the FSA commuication
* interface to operate.
......
......@@ -827,8 +827,8 @@ int aac_command_thread(struct aac_dev * dev)
* Set up the name that will appear in 'ps'
* stored in task_struct.comm[16].
*/
sprintf(current->comm, "aacraid");
daemonize();
daemonize("aacraid");
allow_signal(SIGKILL);
/*
* Let the DPC know it has a place to send the AIF's to.
*/
......
......@@ -53,9 +53,10 @@
#include <linux/blk.h>
#include "scsi.h"
#include "hosts.h"
#include <scsi/scsicam.h>
#include "aacraid.h"
#include "sd.h"
#define AAC_DRIVERNAME "aacraid"
......@@ -127,16 +128,17 @@ static int aac_cfg_open(struct inode * inode, struct file * file);
static int aac_cfg_release(struct inode * inode,struct file * file);
static struct file_operations aac_cfg_fops = {
owner: THIS_MODULE,
ioctl: aac_cfg_ioctl,
open: aac_cfg_open,
release: aac_cfg_release
.owner = THIS_MODULE,
.ioctl = aac_cfg_ioctl,
.open = aac_cfg_open,
.release = aac_cfg_release
};
static int aac_detect(Scsi_Host_Template *);
static int aac_release(struct Scsi_Host *);
static int aac_queuecommand(Scsi_Cmnd *, void (*CompletionRoutine)(Scsi_Cmnd *));
static int aac_biosparm(Scsi_Disk *, kdev_t, int *);
static int aac_biosparm(struct scsi_device *, struct block_device *,
sector_t, int *);
static int aac_procinfo(char *, char **, off_t, int, int, int);
static int aac_ioctl(Scsi_Device *, int, void *);
static int aac_eh_abort(Scsi_Cmnd * cmd);
......@@ -144,7 +146,7 @@ static int aac_eh_device_reset(Scsi_Cmnd* cmd);
static int aac_eh_bus_reset(Scsi_Cmnd* cmd);
static int aac_eh_reset(Scsi_Cmnd* cmd);
static void aac_queuedepth(struct Scsi_Host *, Scsi_Device *);
static int aac_slave_configure(struct scsi_device *);
/**
* aac_detect - Probe for aacraid cards
......@@ -180,7 +182,6 @@ static int aac_detect(Scsi_Host_Template *template)
/* setting up the proc directory structure */
template->proc_name = "aacraid";
spin_unlock_irq(&io_request_lock);
for( index = 0; index != num_aacdrivers; index++ ) {
device_id = aac_drivers[index].device;
......@@ -227,7 +228,7 @@ static int aac_detect(Scsi_Host_Template *template)
host_ptr->irq = dev->irq; /* Adapter IRQ number */
/* host_ptr->base = ( char * )(dev->resource[0].start & ~0xff); */
host_ptr->base = dev->resource[0].start;
scsi_set_pci_device(host_ptr, dev);
scsi_set_device(host_ptr, &dev->dev);
dprintk((KERN_DEBUG "Device base address = 0x%lx [0x%lx].\n", host_ptr->base, dev->resource[0].start));
dprintk((KERN_DEBUG "Device irq = 0x%x.\n", dev->irq));
/*
......@@ -240,12 +241,6 @@ static int aac_detect(Scsi_Host_Template *template)
* value returned as aac->id.
*/
host_ptr->unique_id = aac_count - 1;
/*
* This function is called after the device list has
* been built to find the tagged queueing depth
* supported for each device.
*/
host_ptr->select_queue_depths = aac_queuedepth;
aac = (struct aac_dev *)host_ptr->hostdata;
/* attach a pointer back to Scsi_Host */
aac->scsi_host_ptr = host_ptr;
......@@ -260,7 +255,7 @@ static int aac_detect(Scsi_Host_Template *template)
/* Initialize the ordinal number of the device to -1 */
fsa_dev_ptr = &(aac->fsa_dev);
for( container = 0; container < MAXIMUM_NUM_CONTAINERS; container++ )
fsa_dev_ptr->devno[container] = -1;
fsa_dev_ptr->devname[container][0] = '\0';
dprintk((KERN_DEBUG "Initializing Hardware...\n"));
if((*aac_drivers[index].init)(aac , host_ptr->unique_id) != 0)
......@@ -302,7 +297,6 @@ static int aac_detect(Scsi_Host_Template *template)
if((aac_cfg_major = register_chrdev( 0, "aac", &aac_cfg_fops))<0)
printk(KERN_WARNING "aacraid: unable to register \"aac\" device.\n");
}
spin_lock_irq(&io_request_lock);
template->present = aac_count; /* # of cards of this type found */
return aac_count;
......@@ -399,8 +393,9 @@ struct aac_driver_ident* aac_get_driver_ident(int devtype)
/**
* aac_biosparm - return BIOS parameters for disk
* @disk: SCSI disk object to process
* @device: kdev_t of the disk in question
* @sdev: The scsi device corresponding to the disk
* @bdev: the block device corresponding to the disk
* @capacity: the sector capacity of the disk
* @geom: geometry block to fill in
*
* Return the Heads/Sectors/Cylinders BIOS Disk Parameters for Disk.
......@@ -418,19 +413,20 @@ struct aac_driver_ident* aac_get_driver_ident(int devtype)
* be displayed.
*/
static int aac_biosparm(Scsi_Disk *disk, kdev_t dev, int *geom)
static int aac_biosparm(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int *geom)
{
struct diskparm *param = (struct diskparm *)geom;
struct buffer_head * buf;
unsigned char *buf;
dprintk((KERN_DEBUG "aac_biosparm.\n"));
/*
* Assuming extended translation is enabled - #REVISIT#
*/
if( disk->capacity >= 2 * 1024 * 1024 ) /* 1 GB in 512 byte sectors */
if( capacity >= 2 * 1024 * 1024 ) /* 1 GB in 512 byte sectors */
{
if( disk->capacity >= 4 * 1024 * 1024 ) /* 2 GB in 512 byte sectors */
if( capacity >= 4 * 1024 * 1024 ) /* 2 GB in 512 byte sectors */
{
param->heads = 255;
param->sectors = 63;
......@@ -447,24 +443,23 @@ static int aac_biosparm(Scsi_Disk *disk, kdev_t dev, int *geom)
param->sectors = 32;
}
param->cylinders = disk->capacity/(param->heads * param->sectors);
param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors);
/*
* Read the first 1024 bytes from the disk device
*/
buf = bread(MKDEV(MAJOR(dev), MINOR(dev)&~0xf), 0, block_size(dev));
if(buf == NULL)
return 0;
buf = scsi_bios_ptable(bdev);
/*
* If the boot sector partition table is valid, search for a partition
* table entry whose end_head matches one of the standard geometry
* translations ( 64/32, 128/32, 255/63 ).
*/
if(*(unsigned short *)(buf->b_data + 0x1fe) == cpu_to_le16(0xaa55))
if(*(unsigned short *)(buf + 0x40) == cpu_to_le16(0xaa55))
{
struct partition *first = (struct partition * )(buf->b_data + 0x1be);
struct partition *first = (struct partition * )buf;
struct partition *entry = first;
int saved_cylinders = param->cylinders;
int num;
......@@ -502,7 +497,7 @@ static int aac_biosparm(Scsi_Disk *disk, kdev_t dev, int *geom)
end_sec = first->end_sector & 0x3f;
}
param->cylinders = disk->capacity / (param->heads * param->sectors);
param->cylinders = cap_to_cyls(capacity, param->heads * param->sectors);
if(num < 4 && end_sec == param->sectors)
{
......@@ -518,7 +513,7 @@ static int aac_biosparm(Scsi_Disk *disk, kdev_t dev, int *geom)
param->heads, param->sectors));
}
}
brelse(buf);
kfree(buf);
return 0;
}
......@@ -532,22 +527,18 @@ static int aac_biosparm(Scsi_Disk *disk, kdev_t dev, int *geom)
* A queue depth of one automatically disables tagged queueing.
*/
static void aac_queuedepth(struct Scsi_Host * host, Scsi_Device * dev )
static int aac_slave_configure(struct scsi_device * dev )
{
Scsi_Device * dptr;
if(dev->tagged_supported)
scsi_adjust_queue_depth(dev, MSG_ORDERED_TAG, 128);
else
scsi_adjust_queue_depth(dev, 0, 1);
dprintk((KERN_DEBUG "aac_queuedepth.\n"));
dprintk((KERN_DEBUG "Device # Q Depth Online\n"));
dprintk((KERN_DEBUG "---------------------------\n"));
for(dptr = dev; dptr != NULL; dptr = dptr->next)
{
if(dptr->host == host)
{
dptr->queue_depth = 10;
dprintk((KERN_DEBUG " %2d %d %d\n",
dptr->id, dptr->queue_depth, dptr->online));
}
}
dprintk((KERN_DEBUG "(scsi%d:%d:%d:%d) Tagged Queue depth %2d, "
"%s\n", dev->host->host_no, dev->channel,
dev->id, dev->lun, dev->queue_depth,
dev->online ? "OnLine" : "OffLine"));
return 0;
}
/*------------------------------------------------------------------------------
......@@ -578,7 +569,7 @@ static int aac_ioctl(Scsi_Device * scsi_dev_ptr, int cmd, void * arg)
static int aac_cfg_open(struct inode * inode, struct file * file )
{
unsigned minor_number = MINOR(inode->i_rdev);
unsigned minor_number = minor(inode->i_rdev);
if(minor_number >= aac_count)
return -ENODEV;
return 0;
......@@ -614,7 +605,7 @@ static int aac_cfg_release(struct inode * inode, struct file * file )
static int aac_cfg_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg )
{
struct aac_dev *dev = aac_devices[MINOR(inode->i_rdev)];
struct aac_dev *dev = aac_devices[minor(inode->i_rdev)];
return aac_do_ioctl(dev, cmd, (void *)arg);
}
......@@ -625,27 +616,26 @@ static int aac_cfg_ioctl(struct inode * inode, struct file * file, unsigned int
*/
static Scsi_Host_Template driver_template = {
module: THIS_MODULE,
name: "AAC",
proc_info: aac_procinfo,
detect: aac_detect,
release: aac_release,
info: aac_driverinfo,
ioctl: aac_ioctl,
queuecommand: aac_queuecommand,
bios_param: aac_biosparm,
can_queue: AAC_NUM_IO_FIB,
this_id: 16,
sg_tablesize: 16,
max_sectors: 128,
cmd_per_lun: AAC_NUM_IO_FIB,
eh_abort_handler: aac_eh_abort,
eh_device_reset_handler: aac_eh_device_reset,
eh_bus_reset_handler: aac_eh_bus_reset,
eh_host_reset_handler: aac_eh_reset,
use_new_eh_code: 1,
use_clustering: ENABLE_CLUSTERING,
.module = THIS_MODULE,
.name = "AAC",
.proc_info = aac_procinfo,
.detect = aac_detect,
.release = aac_release,
.info = aac_driverinfo,
.ioctl = aac_ioctl,
.queuecommand = aac_queuecommand,
.bios_param = aac_biosparm,
.slave_configure = aac_slave_configure,
.can_queue = AAC_NUM_IO_FIB,
.this_id = 16,
.sg_tablesize = 16,
.max_sectors = 128,
.cmd_per_lun = AAC_NUM_IO_FIB,
.eh_abort_handler = aac_eh_abort,
.eh_device_reset_handler = aac_eh_device_reset,
.eh_bus_reset_handler = aac_eh_bus_reset,
.eh_host_reset_handler = aac_eh_reset,
.use_clustering = ENABLE_CLUSTERING,
};
/*===========================================================================
......@@ -726,5 +716,3 @@ static int aac_procinfo(char *proc_buffer, char **start_ptr,off_t offset,
*start_ptr = proc_buffer;
return sprintf(proc_buffer, "%s %d\n", "Raid Controller, scsi hba number", host_no);
}
EXPORT_NO_SYMBOLS;
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