]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/aacraid/comminit.c
Pull sn-handle-sc-powerdown into release branch
[linux-2.6-omap-h63xx.git] / drivers / scsi / aacraid / comminit.c
index 43557bf661f63098a2754c3fa255b693d02979c2..1628d094943df1c85f425f0392730b0318549076 100644 (file)
@@ -44,7 +44,9 @@
 
 #include "aacraid.h"
 
-struct aac_common aac_config;
+struct aac_common aac_config = {
+       .irq_mod = 1
+};
 
 static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long commsize, unsigned long commalign)
 {
@@ -114,6 +116,10 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co
        }
 
        init->InitFlags = 0;
+       if (dev->new_comm_interface) {
+               init->InitFlags = cpu_to_le32(INITFLAGS_NEW_COMM_SUPPORTED);
+               dprintk((KERN_WARNING"aacraid: New Comm Interface enabled\n"));
+       }
        init->MaxIoCommands = cpu_to_le32(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB);
        init->MaxIoSize = cpu_to_le32(dev->scsi_host_ptr->max_sectors << 9);
        init->MaxFibSize = cpu_to_le32(dev->max_fib_size);
@@ -179,26 +185,26 @@ int aac_send_shutdown(struct aac_dev * dev)
        struct aac_close *cmd;
        int status;
 
-       fibctx = fib_alloc(dev);
+       fibctx = aac_fib_alloc(dev);
        if (!fibctx)
                return -ENOMEM;
-       fib_init(fibctx);
+       aac_fib_init(fibctx);
 
        cmd = (struct aac_close *) fib_data(fibctx);
 
        cmd->command = cpu_to_le32(VM_CloseAll);
        cmd->cid = cpu_to_le32(0xffffffff);
 
-       status = fib_send(ContainerCommand,
+       status = aac_fib_send(ContainerCommand,
                          fibctx,
                          sizeof(struct aac_close),
                          FsaNormal,
-                         1, 1,
+                         -2 /* Timeout silently */, 1,
                          NULL, NULL);
 
        if (status == 0)
-               fib_complete(fibctx);
-       fib_free(fibctx);
+               aac_fib_complete(fibctx);
+       aac_fib_free(fibctx);
        return status;
 }
 
@@ -311,8 +317,36 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
        dev->max_fib_size = sizeof(struct hw_fib);
        dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size
                - sizeof(struct aac_fibhdr)
-               - sizeof(struct aac_write) + sizeof(struct sgmap))
-                       / sizeof(struct sgmap);
+               - sizeof(struct aac_write) + sizeof(struct sgentry))
+                       / sizeof(struct sgentry);
+       dev->new_comm_interface = 0;
+       dev->raw_io_64 = 0;
+       if ((!aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES,
+               0, 0, 0, 0, 0, 0, status+0, status+1, status+2, NULL, NULL)) &&
+                       (status[0] == 0x00000001)) {
+               if (status[1] & AAC_OPT_NEW_COMM_64)
+                       dev->raw_io_64 = 1;
+               if (status[1] & AAC_OPT_NEW_COMM)
+                       dev->new_comm_interface = dev->a_ops.adapter_send != 0;
+               if (dev->new_comm_interface && (status[2] > dev->base_size)) {
+                       iounmap(dev->regs.sa);
+                       dev->base_size = status[2];
+                       dprintk((KERN_DEBUG "ioremap(%lx,%d)\n",
+                         host->base, status[2]));
+                       dev->regs.sa = ioremap(host->base, status[2]);
+                       if (dev->regs.sa == NULL) {
+                               /* remap failed, go back ... */
+                               dev->new_comm_interface = 0;
+                               dev->regs.sa = ioremap(host->base, 
+                                               AAC_MIN_FOOTPRINT_SIZE);
+                               if (dev->regs.sa == NULL) {     
+                                       printk(KERN_WARNING
+                                         "aacraid: unable to map adapter.\n");
+                                       return NULL;
+                               }
+                       }
+               }
+       }
        if ((!aac_adapter_sync_cmd(dev, GET_COMM_PREFERRED_SETTINGS,
          0, 0, 0, 0, 0, 0,
          status+0, status+1, status+2, status+3, status+4))
@@ -340,8 +374,8 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
                        dev->max_fib_size = 512;
                        dev->sg_tablesize = host->sg_tablesize
                          = (512 - sizeof(struct aac_fibhdr)
-                           - sizeof(struct aac_write) + sizeof(struct sgmap))
-                            / sizeof(struct sgmap);
+                           - sizeof(struct aac_write) + sizeof(struct sgentry))
+                            / sizeof(struct sgentry);
                        host->can_queue = AAC_NUM_IO_FIB;
                } else if (acbsize == 2048) {
                        host->max_sectors = 512;
@@ -393,7 +427,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
        /*
         *      Initialize the list of fibs
         */
-       if(fib_setup(dev)<0){
+       if (aac_fib_setup(dev) < 0) {
                kfree(dev->queues);
                return NULL;
        }