vserver 2.0 rc7
[linux-2.6.git] / drivers / scsi / dpt_i2o.c
index 261836d..53c9b93 100644 (file)
@@ -3,7 +3,6 @@
                              -------------------
     begin                : Thu Sep 7 2000
     copyright            : (C) 2000 by Adaptec
-    email                : deanna_bonds@adaptec.com
 
                           July 30, 2001 First version being submitted
                           for inclusion in the kernel.  V2.4
@@ -68,8 +67,11 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
 #include <asm/pgtable.h>
 #include <asm/io.h>            /* for virt_to_bus, etc. */
 
-#include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_host.h>
+#include <scsi/scsi_tcq.h>
 
 #include "dpt/dptsig.h"
 #include "dpti.h"
@@ -86,9 +88,9 @@ static dpt_sig_S DPTI_sig = {
 #elif defined(__ia64__)
        PROC_INTEL, PROC_IA64,
 #elif defined(__sparc__)
-       PROC_ULTRASPARC,
+       PROC_ULTRASPARC, PROC_ULTRASPARC,
 #elif defined(__alpha__)
-       PROC_ALPHA ,
+       PROC_ALPHA, PROC_ALPHA,
 #else
        (-1),(-1),
 #endif
@@ -105,7 +107,7 @@ static dpt_sig_S DPTI_sig = {
  *============================================================================
  */
 
-DECLARE_MUTEX(adpt_configuration_lock);
+static DECLARE_MUTEX(adpt_configuration_lock);
 
 static struct i2o_sys_tbl *sys_tbl = NULL;
 static int sys_tbl_ind = 0;
@@ -143,7 +145,7 @@ struct adpt_i2o_post_wait_data
 
 static struct adpt_i2o_post_wait_data *adpt_post_wait_queue = NULL;
 static u32 adpt_post_wait_id = 0;
-static spinlock_t adpt_post_wait_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(adpt_post_wait_lock);
 
 
 /*============================================================================
@@ -173,7 +175,7 @@ static struct pci_device_id dptids[] = {
 };
 MODULE_DEVICE_TABLE(pci,dptids);
 
-static int adpt_detect(Scsi_Host_Template* sht)
+static int adpt_detect(struct scsi_host_template* sht)
 {
        struct pci_dev *pDev = NULL;
        adpt_hba* pHba;
@@ -362,7 +364,7 @@ static void adpt_inquiry(adpt_hba* pHba)
 }
 
 
-static int adpt_slave_configure(Scsi_Device * device)
+static int adpt_slave_configure(struct scsi_device * device)
 {
        struct Scsi_Host *host = device->host;
        adpt_hba* pHba;
@@ -378,7 +380,7 @@ static int adpt_slave_configure(Scsi_Device * device)
        return 0;
 }
 
-static int adpt_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
+static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *))
 {
        adpt_hba* pHba = NULL;
        struct adpt_device* pDev = NULL;        /* dpt per device information */
@@ -643,7 +645,7 @@ stop_output:
  *===========================================================================
  */
 
-static int adpt_abort(Scsi_Cmnd * cmd)
+static int adpt_abort(struct scsi_cmnd * cmd)
 {
        adpt_hba* pHba = NULL;  /* host bus adapter structure */
        struct adpt_device* dptdevice;  /* dpt per device information */
@@ -683,7 +685,7 @@ static int adpt_abort(Scsi_Cmnd * cmd)
 // This is the same for BLK and SCSI devices
 // NOTE this is wrong in the i2o.h definitions
 // This is not currently supported by our adapter but we issue it anyway
-static int adpt_device_reset(Scsi_Cmnd* cmd)
+static int adpt_device_reset(struct scsi_cmnd* cmd)
 {
        adpt_hba* pHba;
        u32 msg[4];
@@ -723,7 +725,7 @@ static int adpt_device_reset(Scsi_Cmnd* cmd)
 
 #define I2O_HBA_BUS_RESET 0x87
 // This version of bus reset is called by the eh_error handler
-static int adpt_bus_reset(Scsi_Cmnd* cmd)
+static int adpt_bus_reset(struct scsi_cmnd* cmd)
 {
        adpt_hba* pHba;
        u32 msg[4];
@@ -745,7 +747,7 @@ static int adpt_bus_reset(Scsi_Cmnd* cmd)
 }
 
 // This version of reset is called by the eh_error_handler
-static int adpt_reset(Scsi_Cmnd* cmd)
+static int adpt_reset(struct scsi_cmnd* cmd)
 {
        adpt_hba* pHba;
        int rcode;
@@ -834,7 +836,7 @@ static void adpt_i2o_sys_shutdown(void)
                kfree(p1);
        }
 //     spin_unlock_irqrestore(&adpt_post_wait_lock, flags);
-       adpt_post_wait_queue = 0;
+       adpt_post_wait_queue = NULL;
 
         printk(KERN_INFO "Adaptec I2O controllers down.\n");
 }
@@ -860,7 +862,7 @@ static int adpt_reboot_event(struct notifier_block *n, ulong code, void *p)
 #endif
 
 
-static int adpt_install_hba(Scsi_Host_Template* sht, struct pci_dev* pDev) 
+static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) 
 {
 
        adpt_hba* pHba = NULL;
@@ -869,8 +871,8 @@ static int adpt_install_hba(Scsi_Host_Template* sht, struct pci_dev* pDev)
        ulong base_addr1_phys = 0;
        u32 hba_map0_area_size = 0;
        u32 hba_map1_area_size = 0;
-       ulong base_addr_virt = 0;
-       ulong msg_addr_virt = 0;
+       void __iomem *base_addr_virt = NULL;
+       void __iomem *msg_addr_virt = NULL;
 
        int raptorFlag = FALSE;
        int i;
@@ -904,17 +906,17 @@ static int adpt_install_hba(Scsi_Host_Template* sht, struct pci_dev* pDev)
        }
 
 
-       base_addr_virt = (ulong)ioremap(base_addr0_phys,hba_map0_area_size);
-       if(base_addr_virt == 0) {
+       base_addr_virt = ioremap(base_addr0_phys,hba_map0_area_size);
+       if (!base_addr_virt) {
                PERROR("dpti: adpt_config_hba: io remap failed\n");
                return -EINVAL;
        }
 
         if(raptorFlag == TRUE) {
-               msg_addr_virt = (ulong)ioremap(base_addr1_phys, hba_map1_area_size );
-               if(msg_addr_virt == 0) {
+               msg_addr_virt = ioremap(base_addr1_phys, hba_map1_area_size );
+               if (!msg_addr_virt) {
                        PERROR("dpti: adpt_config_hba: io remap failed on BAR1\n");
-                       iounmap((void*)base_addr_virt);
+                       iounmap(base_addr_virt);
                        return -EINVAL;
                }
        } else {
@@ -925,9 +927,9 @@ static int adpt_install_hba(Scsi_Host_Template* sht, struct pci_dev* pDev)
        pHba = kmalloc(sizeof(adpt_hba), GFP_KERNEL);
        if( pHba == NULL) {
                if(msg_addr_virt != base_addr_virt){
-                       iounmap((void*)msg_addr_virt);
+                       iounmap(msg_addr_virt);
                }
-               iounmap((void*)base_addr_virt);
+               iounmap(base_addr_virt);
                return -ENOMEM;
        }
        memset(pHba, 0, sizeof(adpt_hba));
@@ -958,10 +960,10 @@ static int adpt_install_hba(Scsi_Host_Template* sht, struct pci_dev* pDev)
 
        // Set up the Virtual Base Address of the I2O Device
        pHba->base_addr_virt = base_addr_virt;
-       pHba->msg_addr_virt = msg_addr_virt;  
-       pHba->irq_mask = (ulong)(base_addr_virt+0x30);
-       pHba->post_port = (ulong)(base_addr_virt+0x40);
-       pHba->reply_port = (ulong)(base_addr_virt+0x44);
+       pHba->msg_addr_virt = msg_addr_virt;
+       pHba->irq_mask = base_addr_virt+0x30;
+       pHba->post_port = base_addr_virt+0x40;
+       pHba->reply_port = base_addr_virt+0x44;
 
        pHba->hrt = NULL;
        pHba->lct = NULL;
@@ -977,12 +979,12 @@ static int adpt_install_hba(Scsi_Host_Template* sht, struct pci_dev* pDev)
        spin_lock_init(&adpt_post_wait_lock);
 
        if(raptorFlag == 0){
-               printk(KERN_INFO"Adaptec I2O RAID controller %d at %lx size=%x irq=%d\n", 
+               printk(KERN_INFO"Adaptec I2O RAID controller %d at %p size=%x irq=%d\n", 
                        hba_count-1, base_addr_virt, hba_map0_area_size, pDev->irq);
        } else {
                printk(KERN_INFO"Adaptec I2O RAID controller %d irq=%d\n",hba_count-1, pDev->irq);
-               printk(KERN_INFO"     BAR0 %lx - size= %x\n",base_addr_virt,hba_map0_area_size);
-               printk(KERN_INFO"     BAR1 %lx - size= %x\n",msg_addr_virt,hba_map1_area_size);
+               printk(KERN_INFO"     BAR0 %p - size= %x\n",base_addr_virt,hba_map0_area_size);
+               printk(KERN_INFO"     BAR1 %p - size= %x\n",msg_addr_virt,hba_map1_area_size);
        }
 
        if (request_irq (pDev->irq, adpt_isr, SA_SHIRQ, pHba->name, pHba)) {
@@ -1033,9 +1035,9 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
        hba_count--;
        up(&adpt_configuration_lock);
 
-       iounmap((void*)pHba->base_addr_virt);
+       iounmap(pHba->base_addr_virt);
        if(pHba->msg_addr_virt != pHba->base_addr_virt){
-               iounmap((void*)pHba->msg_addr_virt);
+               iounmap(pHba->msg_addr_virt);
        }
        if(pHba->hrt) {
                kfree(pHba->hrt);
@@ -1176,7 +1178,6 @@ static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout)
                                // dangerous.
                                status = -ETIME;
                        }
-                       schedule_timeout(timeout*HZ);
                }
                if(pHba->host)
                        spin_lock_irq(pHba->host->host_lock);
@@ -1219,7 +1220,7 @@ static s32 adpt_i2o_post_this(adpt_hba* pHba, u32* data, int len)
 {
 
        u32 m = EMPTY_QUEUE;
-       u32 *msg;
+       u32 __iomem *msg;
        ulong timeout = jiffies + 30*HZ;
        do {
                rmb();
@@ -1235,7 +1236,7 @@ static s32 adpt_i2o_post_this(adpt_hba* pHba, u32* data, int len)
                schedule_timeout(1);
        } while(m == EMPTY_QUEUE);
                
-       msg = (u32*) (pHba->msg_addr_virt + m);
+       msg = pHba->msg_addr_virt + m;
        memcpy_toio(msg, data, len);
        wmb();
 
@@ -1632,21 +1633,21 @@ static int adpt_close(struct inode *inode, struct file *file)
 }
 
 
-static int adpt_i2o_passthru(adpt_hba* pHba, u32arg)
+static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg)
 {
        u32 msg[MAX_MESSAGE_SIZE];
        u32* reply = NULL;
        u32 size = 0;
        u32 reply_size = 0;
-       u32* user_msg = (u32*)arg;
-       u32* user_reply = NULL;
-       ulong sg_list[pHba->sg_tablesize];
+       u32 __user *user_msg = arg;
+       u32 __user * user_reply = NULL;
+       void *sg_list[pHba->sg_tablesize];
        u32 sg_offset = 0;
        u32 sg_count = 0;
        int sg_index = 0;
        u32 i = 0;
        u32 rcode = 0;
-       ulong p = 0;
+       void *p = NULL;
        ulong flags = 0;
 
        memset(&msg, 0, MAX_MESSAGE_SIZE*4);
@@ -1663,7 +1664,7 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32* arg)
        size *= 4; // Convert to bytes
 
        /* Copy in the user's I2O command */
-       if(copy_from_user((void*)msg, (void*)user_msg, size)) {
+       if(copy_from_user(msg, user_msg, size)) {
                return -EFAULT;
        }
        get_user(reply_size, &user_reply[0]);
@@ -1702,8 +1703,8 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32* arg)
                        }
                        sg_size = sg[i].flag_count & 0xffffff;      
                        /* Allocate memory for the transfer */
-                       p = (ulong)kmalloc(sg_size, GFP_KERNEL|ADDR32);
-                       if(p == 0) {
+                       p = kmalloc(sg_size, GFP_KERNEL|ADDR32);
+                       if(!p) {
                                printk(KERN_DEBUG"%s: Could not allocate SG buffer - size = %d buffer number %d of %d\n",
                                                pHba->name,sg_size,i,sg_count);
                                rcode = -ENOMEM;
@@ -1713,14 +1714,14 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32* arg)
                        /* Copy in the user's SG buffer if necessary */
                        if(sg[i].flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR*/) {
                                // TODO 64bit fix
-                               if (copy_from_user((void*)p,(void*)sg[i].addr_bus, sg_size)) {
+                               if (copy_from_user(p,(void __user *)sg[i].addr_bus, sg_size)) {
                                        printk(KERN_DEBUG"%s: Could not copy SG buf %d FROM user\n",pHba->name,i);
                                        rcode = -EFAULT;
                                        goto cleanup;
                                }
                        }
                        //TODO 64bit fix
-                       sg[i].addr_bus = (u32)virt_to_bus((void*)p);
+                       sg[i].addr_bus = (u32)virt_to_bus(p);
                }
        }
 
@@ -1762,7 +1763,7 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32* arg)
                size = size>>16;
                size *= 4;
                /* Copy in the user's I2O command */
-               if (copy_from_user ((void*)msg, (void*)user_msg, size)) {
+               if (copy_from_user (msg, user_msg, size)) {
                        rcode = -EFAULT;
                        goto cleanup;
                }
@@ -1775,8 +1776,8 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32* arg)
                        if(! (sg[j].flag_count & 0x4000000 /*I2O_SGL_FLAGS_DIR*/)) {
                                sg_size = sg[j].flag_count & 0xffffff; 
                                // TODO 64bit fix
-                               if (copy_to_user((void*)sg[j].addr_bus,(void*)sg_list[j], sg_size)) {
-                                       printk(KERN_WARNING"%s: Could not copy %lx TO user %x\n",pHba->name, sg_list[j], sg[j].addr_bus);
+                               if (copy_to_user((void __user *)sg[j].addr_bus,sg_list[j], sg_size)) {
+                                       printk(KERN_WARNING"%s: Could not copy %p TO user %x\n",pHba->name, sg_list[j], sg[j].addr_bus);
                                        rcode = -EFAULT;
                                        goto cleanup;
                                }
@@ -1804,7 +1805,7 @@ cleanup:
        while(sg_index) {
                if(sg_list[--sg_index]) {
                        if (rcode != -ETIME && rcode != -EINTR)
-                               kfree((void*)(sg_list[sg_index]));
+                               kfree(sg_list[sg_index]);
                }
        }
        return rcode;
@@ -1817,7 +1818,7 @@ cleanup:
  */
 
 /* Get all the info we can not get from kernel services */
-static int adpt_system_info(void *buffer)
+static int adpt_system_info(void __user *buffer)
 {
        sysInfo_S si;
 
@@ -1913,6 +1914,7 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
        int error = 0;
        adpt_hba* pHba;
        ulong flags = 0;
+       void __user *argp = (void __user *)arg;
 
        minor = iminor(inode);
        if (minor >= DPTI_MAX_HBA){
@@ -1938,13 +1940,12 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
        switch (cmd) {
        // TODO: handle 3 cases
        case DPT_SIGNATURE:
-               if (copy_to_user((char*)arg, &DPTI_sig, sizeof(DPTI_sig))) {
+               if (copy_to_user(argp, &DPTI_sig, sizeof(DPTI_sig))) {
                        return -EFAULT;
                }
                break;
        case I2OUSRCMD:
-               return  adpt_i2o_passthru(pHba,(u32*)arg);
-               break;
+               return adpt_i2o_passthru(pHba, argp);
 
        case DPT_CTRLINFO:{
                drvrHBAinfo_S HbaInfo;
@@ -1960,19 +1961,18 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
                HbaInfo.pciDeviceNum=PCI_SLOT(pHba->pDev->devfn); 
                HbaInfo.Interrupt = pHba->pDev->irq; 
                HbaInfo.hbaFlags = FLG_OSD_PCI_VALID | FLG_OSD_DMA | FLG_OSD_I2O;
-               if(copy_to_user((void *) arg, &HbaInfo, sizeof(HbaInfo))){
+               if(copy_to_user(argp, &HbaInfo, sizeof(HbaInfo))){
                        printk(KERN_WARNING"%s: Could not copy HbaInfo TO user\n",pHba->name);
                        return -EFAULT;
                }
                break;
                }
        case DPT_SYSINFO:
-               return adpt_system_info((void*)arg);
-               break;
+               return adpt_system_info(argp);
        case DPT_BLINKLED:{
                u32 value;
                value = (u32)adpt_read_blink_led(pHba);
-               if (copy_to_user((char*)arg, &value, sizeof(value))) {
+               if (copy_to_user(argp, &value, sizeof(value))) {
                        return -EFAULT;
                }
                break;
@@ -1997,7 +1997,7 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
 
 static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs)
 {
-       Scsi_Cmnd* cmd;
+       struct scsi_cmnd* cmd;
        adpt_hba* pHba = dev_id;
        u32 m;
        ulong reply;
@@ -2059,14 +2059,14 @@ static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs)
                                status = I2O_POST_WAIT_OK;
                        }
                        if(!(context & 0x40000000)) {
-                               cmd = (Scsi_Cmnd*) readl(reply+12); 
+                               cmd = (struct scsi_cmnd*) readl(reply+12); 
                                if(cmd != NULL) {
                                        printk(KERN_WARNING"%s: Apparent SCSI cmd in Post Wait Context - cmd=%p context=%x\n", pHba->name, cmd, context);
                                }
                        }
                        adpt_i2o_post_wait_complete(context, status);
                } else { // SCSI message
-                       cmd = (Scsi_Cmnd*) readl(reply+12); 
+                       cmd = (struct scsi_cmnd*) readl(reply+12); 
                        if(cmd != NULL){
                                if(cmd->serial_number != 0) { // If not timedout
                                        adpt_i2o_to_scsi(reply, cmd);
@@ -2083,7 +2083,7 @@ out:      if(pHba->host)
        return IRQ_RETVAL(handled);
 }
 
-static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device* d)
+static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* d)
 {
        int i;
        u32 msg[MAX_MESSAGE_SIZE];
@@ -2108,16 +2108,16 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device*
                 * cmd->cmnd[0] is an unsigned char
                 */
                switch(cmd->sc_data_direction){
-               case SCSI_DATA_READ:
+               case DMA_FROM_DEVICE:
                        scsidir  =0x40000000;   // DATA IN  (iop<--dev)
                        break;
-               case SCSI_DATA_WRITE:
+               case DMA_TO_DEVICE:
                        direction=0x04000000;   // SGL OUT
                        scsidir  =0x80000000;   // DATA OUT (iop-->dev)
                        break;
-               case SCSI_DATA_NONE:
+               case DMA_NONE:
                        break;
-               case SCSI_DATA_UNKNOWN:
+               case DMA_BIDIRECTIONAL:
                        scsidir  =0x40000000;   // DATA IN  (iop<--dev)
                        // Assume In - and continue;
                        break;
@@ -2156,7 +2156,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device*
        if(cmd->use_sg) {
                struct scatterlist *sg = (struct scatterlist *)cmd->request_buffer;
                int sg_count = pci_map_sg(pHba->pDev, sg, cmd->use_sg,
-                        scsi_to_pci_dma_dir(cmd->sc_data_direction));
+                               cmd->sc_data_direction);
 
 
                len = 0;
@@ -2184,7 +2184,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device*
                        *mptr++ = pci_map_single(pHba->pDev,
                                cmd->request_buffer,
                                cmd->request_bufflen,
-                               scsi_to_pci_dma_dir(cmd->sc_data_direction));
+                               cmd->sc_data_direction);
                }
        }
        
@@ -2200,7 +2200,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device*
 }
 
 
-static s32 adpt_scsi_register(adpt_hba* pHba,Scsi_Host_Template * sht)
+static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht)
 {
        struct Scsi_Host *host = NULL;
 
@@ -2231,7 +2231,7 @@ static s32 adpt_scsi_register(adpt_hba* pHba,Scsi_Host_Template * sht)
 }
 
 
-static s32 adpt_i2o_to_scsi(ulong reply, Scsi_Cmnd* cmd)
+static s32 adpt_i2o_to_scsi(ulong reply, struct scsi_cmnd* cmd)
 {
        adpt_hba* pHba;
        u32 hba_status;
@@ -2533,8 +2533,8 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
 
 static void adpt_fail_posted_scbs(adpt_hba* pHba)
 {
-       Scsi_Cmnd*      cmd = NULL;
-       Scsi_Device*    d = NULL;
+       struct scsi_cmnd*       cmd = NULL;
+       struct scsi_device*     d = NULL;
 
        shost_for_each_device(d, pHba->host) {
                unsigned long flags;
@@ -2636,7 +2636,7 @@ static int adpt_i2o_online_hba(adpt_hba* pHba)
 
 static s32 adpt_send_nop(adpt_hba*pHba,u32 m)
 {
-       u32 *msg;
+       u32 __iomem *msg;
        ulong timeout = jiffies + 5*HZ;
 
        while(m == EMPTY_QUEUE){
@@ -2652,7 +2652,7 @@ static s32 adpt_send_nop(adpt_hba*pHba,u32 m)
                set_current_state(TASK_UNINTERRUPTIBLE);
                schedule_timeout(1);
        }
-       msg = (u32*)(pHba->msg_addr_virt + m);
+       msg = (u32 __iomem *)(pHba->msg_addr_virt + m);
        writel( THREE_WORD_MSG_SIZE | SGL_OFFSET_0,&msg[0]);
        writel( I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | 0,&msg[1]);
        writel( 0,&msg[2]);
@@ -2666,7 +2666,7 @@ static s32 adpt_send_nop(adpt_hba*pHba,u32 m)
 static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba)
 {
        u8 *status;
-       u32 *msg = NULL;
+       u32 __iomem *msg = NULL;
        int i;
        ulong timeout = jiffies + TMOUT_INITOUTBOUND*HZ;
        u32* ptr;
@@ -2688,7 +2688,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba)
                schedule_timeout(1);
        } while(m == EMPTY_QUEUE);
 
-       msg=(u32 *)(pHba->msg_addr_virt+m);
+       msg=(u32 __iomem *)(pHba->msg_addr_virt+m);
 
        status = kmalloc(4,GFP_KERNEL|ADDR32);
        if (status==NULL) {
@@ -2773,7 +2773,7 @@ static s32 adpt_i2o_status_get(adpt_hba* pHba)
 {
        ulong timeout;
        u32 m;
-       u32 *msg;
+       u32 __iomem *msg;
        u8 *status_block=NULL;
        ulong status_block_bus;
 
@@ -2807,7 +2807,7 @@ static s32 adpt_i2o_status_get(adpt_hba* pHba)
        } while(m==EMPTY_QUEUE);
 
        
-       msg=(u32*)(pHba->msg_addr_virt+m);
+       msg=(u32 __iomem *)(pHba->msg_addr_virt+m);
 
        writel(NINE_WORD_MSG_SIZE|SGL_OFFSET_0, &msg[0]);
        writel(I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID, &msg[1]);
@@ -3358,7 +3358,7 @@ static static void adpt_delay(int millisec)
 
 #endif
 
-static Scsi_Host_Template driver_template = {
+static struct scsi_host_template driver_template = {
        .name                   = "dpt_i2o",
        .proc_name              = "dpt_i2o",
        .proc_info              = adpt_proc_info,