Commit 7dfa0f26 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[SCSI] remove dma_mask hacks

pci_alloc_consistent is under 4G by default.  Also simplify the
definition of bus_dmamap_t.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent dedd8310
......@@ -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;
......
......@@ -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;
};
......
......@@ -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);
......
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