virtio: add virtio disk geometry feature
[safe/jmp/linux-2.6] / drivers / block / DAC960.c
index 92bf868..cd03473 100644 (file)
@@ -17,8 +17,8 @@
 */
 
 
-#define DAC960_DriverVersion                   "2.5.48"
-#define DAC960_DriverDate                      "14 May 2006"
+#define DAC960_DriverVersion                   "2.5.49"
+#define DAC960_DriverDate                      "21 Aug 2007"
 
 
 #include <linux/module.h>
@@ -31,6 +31,7 @@
 #include <linux/genhd.h>
 #include <linux/hdreg.h>
 #include <linux/blkpg.h>
+#include <linux/dma-mapping.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/mm.h>
@@ -43,6 +44,7 @@
 #include <linux/init.h>
 #include <linux/jiffies.h>
 #include <linux/random.h>
+#include <linux/scatterlist.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include "DAC960.h"
@@ -344,6 +346,7 @@ static bool DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
        Command->V1.ScatterGatherList =
                (DAC960_V1_ScatterGatherSegment_T *)ScatterGatherCPU;
        Command->V1.ScatterGatherListDMA = ScatterGatherDMA;
+       sg_init_table(Command->cmd_sglist, DAC960_V1_ScatterGatherLimit);
       } else {
         Command->cmd_sglist = Command->V2.ScatterList;
        Command->V2.ScatterGatherList =
@@ -352,6 +355,7 @@ static bool DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
        Command->V2.RequestSense =
                                (DAC960_SCSI_RequestSense_T *)RequestSenseCPU;
        Command->V2.RequestSenseDMA = RequestSenseDMA;
+       sg_init_table(Command->cmd_sglist, DAC960_V2_ScatterGatherLimit);
       }
     }
   return true;
@@ -1165,9 +1169,9 @@ static bool DAC960_V1_EnableMemoryMailboxInterface(DAC960_Controller_T
   int i;
 
   
-  if (pci_set_dma_mask(Controller->PCIDevice, DAC690_V1_PciDmaMask))
+  if (pci_set_dma_mask(Controller->PCIDevice, DMA_32BIT_MASK))
        return DAC960_Failure(Controller, "DMA mask out of range");
-  Controller->BounceBufferLimit = DAC690_V1_PciDmaMask;
+  Controller->BounceBufferLimit = DMA_32BIT_MASK;
 
   if ((hw_type == DAC960_PD_Controller) || (hw_type == DAC960_P_Controller)) {
     CommandMailboxesSize =  0;
@@ -1368,9 +1372,12 @@ static bool DAC960_V2_EnableMemoryMailboxInterface(DAC960_Controller_T
   dma_addr_t   CommandMailboxDMA;
   DAC960_V2_CommandStatus_T CommandStatus;
 
-  if (pci_set_dma_mask(Controller->PCIDevice, DAC690_V2_PciDmaMask))
-       return DAC960_Failure(Controller, "DMA mask out of range");
-  Controller->BounceBufferLimit = DAC690_V2_PciDmaMask;
+       if (!pci_set_dma_mask(Controller->PCIDevice, DMA_64BIT_MASK))
+               Controller->BounceBufferLimit = DMA_64BIT_MASK;
+       else if (!pci_set_dma_mask(Controller->PCIDevice, DMA_32BIT_MASK))
+               Controller->BounceBufferLimit = DMA_32BIT_MASK;
+       else
+               return DAC960_Failure(Controller, "DMA mask out of range");
 
   /* This is a temporary dma mapping, used only in the scope of this function */
   CommandMailbox = pci_alloc_consistent(PCI_Device,
@@ -3448,19 +3455,12 @@ static inline bool DAC960_ProcessCompletedRequest(DAC960_Command_T *Command,
                                                 bool SuccessfulIO)
 {
        struct request *Request = Command->Request;
-       int UpToDate;
-
-       UpToDate = 0;
-       if (SuccessfulIO)
-               UpToDate = 1;
+       int Error = SuccessfulIO ? 0 : -EIO;
 
        pci_unmap_sg(Command->Controller->PCIDevice, Command->cmd_sglist,
                Command->SegmentCount, Command->DmaDirection);
 
-        if (!end_that_request_first(Request, UpToDate, Command->BlockCount)) {
-               add_disk_randomness(Request->rq_disk);
-               end_that_request_last(Request, UpToDate);
-
+        if (!__blk_end_request(Request, Error, Command->BlockCount << 9)) {
                if (Command->Completion) {
                        complete(Command->Completion);
                        Command->Completion = NULL;