Commit 23efa200 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

ips 2/4: 2.4 resync

From: David Jeffery <david_jeffery@adaptec.com>
(with minor fixes for rejects)

This patch is a resync with the 6.10 driver for 2.4 and updates the 2.4
compatability code.  It adds a new wrapper function for differences
between the 2.4 and 2.6 scsi proc interface,  forces pci posting in 3
places, corrects using a meaningless constant of 0x80 to 0, and syncs
comments that had changed. 
parent 3ecd3030
...@@ -130,6 +130,7 @@ ...@@ -130,6 +130,7 @@
/* 5.10.15 - remove unused code (sem, macros, etc.) */ /* 5.10.15 - remove unused code (sem, macros, etc.) */
/* 5.30.00 - use __devexit_p() */ /* 5.30.00 - use __devexit_p() */
/* 6.00.00 - Add 6x Adapters and Battery Flash */ /* 6.00.00 - Add 6x Adapters and Battery Flash */
/* 6.10.00 - Remove 1G Addressing Limitations */
/*****************************************************************************/ /*****************************************************************************/
/* /*
...@@ -202,6 +203,7 @@ MODULE_PARM(ips, "s"); ...@@ -202,6 +203,7 @@ MODULE_PARM(ips, "s");
#endif #endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
#include <linux/blk.h>
#include "sd.h" #include "sd.h"
#define IPS_SG_ADDRESS(sg) ((sg)->address) #define IPS_SG_ADDRESS(sg) ((sg)->address)
#define IPS_LOCK_SAVE(lock,flags) spin_lock_irqsave(&io_request_lock,flags) #define IPS_LOCK_SAVE(lock,flags) spin_lock_irqsave(&io_request_lock,flags)
...@@ -257,9 +259,12 @@ static Scsi_Host_Template ips_driver_template = { ...@@ -257,9 +259,12 @@ static Scsi_Host_Template ips_driver_template = {
.queuecommand = ips_queue, .queuecommand = ips_queue,
.eh_abort_handler = ips_eh_abort, .eh_abort_handler = ips_eh_abort,
.eh_host_reset_handler = ips_eh_reset, .eh_host_reset_handler = ips_eh_reset,
.proc_name = "ips",
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
.proc_info = ips_proc_info,
.slave_configure = ips_slave_configure, .slave_configure = ips_slave_configure,
#else #else
.proc_info = ips_proc24_info,
.select_queue_depths = ips_select_queue_depth, .select_queue_depths = ips_select_queue_depth,
#endif #endif
.bios_param = ips_biosparam, .bios_param = ips_biosparam,
...@@ -319,8 +324,8 @@ static char ips_adapter_name[][30] = { ...@@ -319,8 +324,8 @@ static char ips_adapter_name[][30] = {
"ServeRAID 4Lx", "ServeRAID 4Lx",
"ServeRAID 5i", "ServeRAID 5i",
"ServeRAID 5i", "ServeRAID 5i",
"ServeRAID 00", "ServeRAID 6M",
"ServeRAID 00" "ServeRAID 6i"
}; };
static struct notifier_block ips_notifier = { static struct notifier_block ips_notifier = {
...@@ -593,9 +598,6 @@ ips_detect(Scsi_Host_Template * SHT) ...@@ -593,9 +598,6 @@ ips_detect(Scsi_Host_Template * SHT)
} }
} }
SHT->proc_info = ips_proc_info;
SHT->proc_name = "ips";
for (i = 0; i < ips_num_controllers; i++) { for (i = 0; i < ips_num_controllers; i++) {
if (ips_register_scsi(i)) if (ips_register_scsi(i))
ips_free(ips_ha[i]); ips_free(ips_ha[i]);
...@@ -1120,7 +1122,7 @@ ips_queue(Scsi_Cmnd * SC, void (*done) (Scsi_Cmnd *)) ...@@ -1120,7 +1122,7 @@ ips_queue(Scsi_Cmnd * SC, void (*done) (Scsi_Cmnd *))
ips_copp_wait_item_t *scratch; ips_copp_wait_item_t *scratch;
/* A Reset IOCTL is only sent by the ServeRAID boot CD in extreme cases. */ /* A Reset IOCTL is only sent by the boot CD in extreme cases. */
/* There can never be any system activity ( network or disk ), but check */ /* There can never be any system activity ( network or disk ), but check */
/* anyway just as a good practice. */ /* anyway just as a good practice. */
pt = (ips_passthru_t *) SC->request_buffer; pt = (ips_passthru_t *) SC->request_buffer;
...@@ -1220,6 +1222,24 @@ ips_biosparam(struct scsi_device *sdev, struct block_device *bdev, ...@@ -1220,6 +1222,24 @@ ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
/* ips_proc24_info is a wrapper around ips_proc_info *
* for compatibility with the 2.4 scsi parameters */
static int
ips_proc24_info(char *buffer, char **start, off_t offset, int length,
int hostno, int func)
{
int i;
for (i = 0; i < ips_next_controller; i++) {
if (ips_sh[i] && ips_sh[i]->host_no == hostno) {
return ips_proc_info(ips_sh[i], buffer, start,
offset, length, func);
}
}
return -EINVAL;
}
/****************************************************************************/ /****************************************************************************/
/* */ /* */
/* Routine Name: ips_select_queue_depth */ /* Routine Name: ips_select_queue_depth */
...@@ -3499,7 +3519,7 @@ ips_done(ips_ha_t * ha, ips_scb_t * scb) ...@@ -3499,7 +3519,7 @@ ips_done(ips_ha_t * ha, ips_scb_t * scb)
/* */ /* */
/* Routine Description: */ /* Routine Description: */
/* */ /* */
/* Map ServeRAID error codes to Linux Error Codes */ /* Map Controller Error codes to Linux Error Codes */
/* */ /* */
/****************************************************************************/ /****************************************************************************/
static int static int
...@@ -3753,7 +3773,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb) ...@@ -3753,7 +3773,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
/* internal command */ /* internal command */
if (scb->bus > 0) { if (scb->bus > 0) {
/* ServeRAID commands can't be issued */ /* Controller commands can't be issued */
/* to real devices -- fail them */ /* to real devices -- fail them */
if ((ha->waitflag == TRUE) && if ((ha->waitflag == TRUE) &&
(ha->cmd_in_progress == scb->cdb[0])) { (ha->cmd_in_progress == scb->cdb[0])) {
...@@ -4865,6 +4885,7 @@ ips_enable_int_copperhead(ips_ha_t * ha) ...@@ -4865,6 +4885,7 @@ ips_enable_int_copperhead(ips_ha_t * ha)
METHOD_TRACE("ips_enable_int_copperhead", 1); METHOD_TRACE("ips_enable_int_copperhead", 1);
outb(ha->io_addr + IPS_REG_HISR, IPS_BIT_EI); outb(ha->io_addr + IPS_REG_HISR, IPS_BIT_EI);
inb(ha->io_addr + IPS_REG_HISR); /*Ensure PCI Posting Completes*/
} }
/****************************************************************************/ /****************************************************************************/
...@@ -4881,6 +4902,7 @@ ips_enable_int_copperhead_memio(ips_ha_t * ha) ...@@ -4881,6 +4902,7 @@ ips_enable_int_copperhead_memio(ips_ha_t * ha)
METHOD_TRACE("ips_enable_int_copperhead_memio", 1); METHOD_TRACE("ips_enable_int_copperhead_memio", 1);
writeb(IPS_BIT_EI, ha->mem_ptr + IPS_REG_HISR); writeb(IPS_BIT_EI, ha->mem_ptr + IPS_REG_HISR);
readb(ha->mem_ptr + IPS_REG_HISR); /*Ensure PCI Posting Completes*/
} }
/****************************************************************************/ /****************************************************************************/
...@@ -4901,6 +4923,7 @@ ips_enable_int_morpheus(ips_ha_t * ha) ...@@ -4901,6 +4923,7 @@ ips_enable_int_morpheus(ips_ha_t * ha)
Oimr = readl(ha->mem_ptr + IPS_REG_I960_OIMR); Oimr = readl(ha->mem_ptr + IPS_REG_I960_OIMR);
Oimr &= ~0x08; Oimr &= ~0x08;
writel(Oimr, ha->mem_ptr + IPS_REG_I960_OIMR); writel(Oimr, ha->mem_ptr + IPS_REG_I960_OIMR);
readl(ha->mem_ptr + IPS_REG_I960_OIMR); /*Ensure PCI Posting Completes*/
} }
/****************************************************************************/ /****************************************************************************/
...@@ -6190,7 +6213,7 @@ ips_ffdc_time(ips_ha_t * ha) ...@@ -6190,7 +6213,7 @@ ips_ffdc_time(ips_ha_t * ha)
scb->cmd.ffdc.op_code = IPS_CMD_FFDC; scb->cmd.ffdc.op_code = IPS_CMD_FFDC;
scb->cmd.ffdc.command_id = IPS_COMMAND_ID(ha, scb); scb->cmd.ffdc.command_id = IPS_COMMAND_ID(ha, scb);
scb->cmd.ffdc.reset_count = 0; scb->cmd.ffdc.reset_count = 0;
scb->cmd.ffdc.reset_type = 0x80; scb->cmd.ffdc.reset_type = 0;
/* convert time to what the card wants */ /* convert time to what the card wants */
ips_fix_ffdc_time(ha, scb, ha->last_ffdc); ips_fix_ffdc_time(ha, scb, ha->last_ffdc);
...@@ -6779,7 +6802,7 @@ ips_verify_bios_memio(ips_ha_t * ha, char *buffer, uint32_t buffersize, ...@@ -6779,7 +6802,7 @@ ips_verify_bios_memio(ips_ha_t * ha, char *buffer, uint32_t buffersize,
/* Assumes that ips_read_adapter_status() is called first filling in */ /* Assumes that ips_read_adapter_status() is called first filling in */
/* the data for SubSystem Parameters. */ /* the data for SubSystem Parameters. */
/* Called from ips_write_driver_status() so it also assumes NVRAM Page 5 */ /* Called from ips_write_driver_status() so it also assumes NVRAM Page 5 */
/* Data is availaible. */ /* Data is available. */
/* */ /* */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
...@@ -6864,7 +6887,7 @@ ips_version_check(ips_ha_t * ha, int intr) ...@@ -6864,7 +6887,7 @@ ips_version_check(ips_ha_t * ha, int intr)
/* Routine Name: ips_get_version_info */ /* Routine Name: ips_get_version_info */
/* */ /* */
/* Routine Description: */ /* Routine Description: */
/* Issue an internal GETVERSION ServeRAID Command */ /* Issue an internal GETVERSION Command */
/* */ /* */
/* Return Value: */ /* Return Value: */
/* 0 if Successful, else non-zero */ /* 0 if Successful, else non-zero */
......
...@@ -106,8 +106,10 @@ ...@@ -106,8 +106,10 @@
#define IPS_REMOVE_HOST(shost) #define IPS_REMOVE_HOST(shost)
#define IPS_SCSI_SET_DEVICE(sh,ha) scsi_set_pci_device(sh, (ha)->pcidev) #define IPS_SCSI_SET_DEVICE(sh,ha) scsi_set_pci_device(sh, (ha)->pcidev)
#define IPS_PRINTK(level, pcidev, format, arg...) \ #define IPS_PRINTK(level, pcidev, format, arg...) \
printk(level "%s %s:" format , (pcidev)->driver->name , \ printk(level "%s %s:" format , "ips" , \
pci_name(pcidev) , ## arg) (pcidev)->slot_name , ## arg)
#define scsi_host_alloc(sh,size) scsi_register(sh,size)
#define scsi_host_put(sh) scsi_unregister(sh)
#else #else
#define IPS_REGISTER_HOSTS(SHT) (!ips_detect(SHT)) #define IPS_REGISTER_HOSTS(SHT) (!ips_detect(SHT))
#define IPS_UNREGISTER_HOSTS(SHT) #define IPS_UNREGISTER_HOSTS(SHT)
...@@ -451,9 +453,11 @@ ...@@ -451,9 +453,11 @@
* Scsi_Host Template * Scsi_Host Template
*/ */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
static int ips_proc24_info(char *, char **, off_t, int, int, int);
static void ips_select_queue_depth(struct Scsi_Host *, Scsi_Device *); static void ips_select_queue_depth(struct Scsi_Host *, Scsi_Device *);
static int ips_biosparam(Disk *disk, kdev_t dev, int geom[]); static int ips_biosparam(Disk *disk, kdev_t dev, int geom[]);
#else #else
int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev, static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int geom[]); sector_t capacity, int geom[]);
int ips_slave_configure(Scsi_Device *SDptr); int ips_slave_configure(Scsi_Device *SDptr);
......
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