[SCSI] remove dma_mask hacks
authorChristoph Hellwig <hch@lst.de>
Mon, 16 May 2005 16:54:12 +0000 (18:54 +0200)
committerJames Bottomley <jejb@mulgrave.(none)>
Fri, 20 May 2005 20:54:37 +0000 (15:54 -0500)
pci_alloc_consistent is under 4G by default.  Also simplify the
definition of bus_dmamap_t.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/aic7xxx/aic7xxx_osm.c
drivers/scsi/aic7xxx/aic7xxx_osm.h
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c

index 37fda70b5435fb6f040aa1ecf2653c52e3295e72..717401b26b6f0b3b217cb822ab82bc7eba53d8ab 100644 (file)
@@ -949,37 +949,11 @@ int
 ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr,
                 int flags, bus_dmamap_t *mapp)
 {
-       bus_dmamap_t map;
-
-       map = malloc(sizeof(*map), M_DEVBUF, M_NOWAIT);
-       if (map == NULL)
-               return (ENOMEM);
-       /*
-        * Although we can dma data above 4GB, our
-        * "consistent" memory is below 4GB for
-        * space efficiency reasons (only need a 4byte
-        * address).  For this reason, we have to reset
-        * our dma mask when doing allocations.
-        */
-       if (ahc->dev_softc != NULL)
-               if (pci_set_dma_mask(ahc->dev_softc, 0xFFFFFFFF)) {
-                       printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
-                       kfree(map);
-                       return (ENODEV);
-               }
        *vaddr = pci_alloc_consistent(ahc->dev_softc,
-                                     dmat->maxsize, &map->bus_addr);
-       if (ahc->dev_softc != NULL)
-               if (pci_set_dma_mask(ahc->dev_softc,
-                                    ahc->platform_data->hw_dma_mask)) {
-                       printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
-                       kfree(map);
-                       return (ENODEV);
-               }
+                                     dmat->maxsize, mapp);
        if (*vaddr == NULL)
-               return (ENOMEM);
-       *mapp = map;
-       return(0);
+               return ENOMEM;
+       return 0;
 }
 
 void
@@ -987,7 +961,7 @@ ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat,
                void* vaddr, bus_dmamap_t map)
 {
        pci_free_consistent(ahc->dev_softc, dmat->maxsize,
-                           vaddr, map->bus_addr);
+                           vaddr, map);
 }
 
 int
@@ -1001,7 +975,7 @@ ahc_dmamap_load(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map,
         */
        bus_dma_segment_t stack_sg;
 
-       stack_sg.ds_addr = map->bus_addr;
+       stack_sg.ds_addr = map;
        stack_sg.ds_len = dmat->maxsize;
        cb(cb_arg, &stack_sg, /*nseg*/1, /*error*/0);
        return (0);
@@ -1010,12 +984,6 @@ ahc_dmamap_load(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map,
 void
 ahc_dmamap_destroy(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map)
 {
-       /*
-        * The map may is NULL in our < 2.3.X implementation.
-        * Now it's 2.6.5, but just in case...
-        */
-       BUG_ON(map == NULL);
-       free(map, M_DEVBUF);
 }
 
 int
@@ -1382,7 +1350,6 @@ ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg)
        TAILQ_INIT(&ahc->platform_data->completeq);
        TAILQ_INIT(&ahc->platform_data->device_runq);
        ahc->platform_data->irq = AHC_LINUX_NOIRQ;
-       ahc->platform_data->hw_dma_mask = 0xFFFFFFFF;
        ahc_lockinit(ahc);
        init_timer(&ahc->platform_data->completeq_timer);
        ahc->platform_data->completeq_timer.data = (u_long)ahc;
index 752022e4d4d419f10449267d5b0d37744fca5817..9cfb46b4b15f2d0dd882a2660735a1e1bfac3c70 100644 (file)
@@ -174,11 +174,7 @@ struct ahc_linux_dma_tag
 };
 typedef struct ahc_linux_dma_tag* bus_dma_tag_t;
 
-struct ahc_linux_dmamap
-{
-       dma_addr_t      bus_addr;
-};
-typedef struct ahc_linux_dmamap* bus_dmamap_t;
+typedef dma_addr_t bus_dmamap_t;
 
 typedef int bus_dma_filter_t(void*, dma_addr_t);
 typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int);
@@ -479,7 +475,6 @@ struct ahc_platform_data {
        uint32_t                 irq;           /* IRQ for this adapter */
        uint32_t                 bios_address;
        uint32_t                 mem_busaddr;   /* Mem Base Addr */
-       uint64_t                 hw_dma_mask;
        ahc_linux_softc_flags    flags;
 };
 
index 886f92f918469b0ce33aa19ba57cfd33f38ff714..2a0ebce83e7a61c4e0b11903fb523bdcd877fd21 100644 (file)
@@ -221,13 +221,11 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
         && ahc_linux_get_memsize() > 0x80000000
         && pci_set_dma_mask(pdev, mask_39bit) == 0) {
                ahc->flags |= AHC_39BIT_ADDRESSING;
-               ahc->platform_data->hw_dma_mask = mask_39bit;
        } else {
                if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
                        printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
                        return (-ENODEV);
                }
-               ahc->platform_data->hw_dma_mask = DMA_32BIT_MASK;
        }
        ahc->dev_softc = pci;
        error = ahc_pci_config(ahc, entry);