diff options
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm.c | 43 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm.h | 7 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | 2 |
3 files changed, 6 insertions, 46 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 37fda70b5435..717401b26b6f 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -949,37 +949,11 @@ int | |||
949 | ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr, | 949 | ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr, |
950 | int flags, bus_dmamap_t *mapp) | 950 | int flags, bus_dmamap_t *mapp) |
951 | { | 951 | { |
952 | bus_dmamap_t map; | ||
953 | |||
954 | map = malloc(sizeof(*map), M_DEVBUF, M_NOWAIT); | ||
955 | if (map == NULL) | ||
956 | return (ENOMEM); | ||
957 | /* | ||
958 | * Although we can dma data above 4GB, our | ||
959 | * "consistent" memory is below 4GB for | ||
960 | * space efficiency reasons (only need a 4byte | ||
961 | * address). For this reason, we have to reset | ||
962 | * our dma mask when doing allocations. | ||
963 | */ | ||
964 | if (ahc->dev_softc != NULL) | ||
965 | if (pci_set_dma_mask(ahc->dev_softc, 0xFFFFFFFF)) { | ||
966 | printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n"); | ||
967 | kfree(map); | ||
968 | return (ENODEV); | ||
969 | } | ||
970 | *vaddr = pci_alloc_consistent(ahc->dev_softc, | 952 | *vaddr = pci_alloc_consistent(ahc->dev_softc, |
971 | dmat->maxsize, &map->bus_addr); | 953 | dmat->maxsize, mapp); |
972 | if (ahc->dev_softc != NULL) | ||
973 | if (pci_set_dma_mask(ahc->dev_softc, | ||
974 | ahc->platform_data->hw_dma_mask)) { | ||
975 | printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n"); | ||
976 | kfree(map); | ||
977 | return (ENODEV); | ||
978 | } | ||
979 | if (*vaddr == NULL) | 954 | if (*vaddr == NULL) |
980 | return (ENOMEM); | 955 | return ENOMEM; |
981 | *mapp = map; | 956 | return 0; |
982 | return(0); | ||
983 | } | 957 | } |
984 | 958 | ||
985 | void | 959 | void |
@@ -987,7 +961,7 @@ ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat, | |||
987 | void* vaddr, bus_dmamap_t map) | 961 | void* vaddr, bus_dmamap_t map) |
988 | { | 962 | { |
989 | pci_free_consistent(ahc->dev_softc, dmat->maxsize, | 963 | pci_free_consistent(ahc->dev_softc, dmat->maxsize, |
990 | vaddr, map->bus_addr); | 964 | vaddr, map); |
991 | } | 965 | } |
992 | 966 | ||
993 | int | 967 | int |
@@ -1001,7 +975,7 @@ ahc_dmamap_load(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map, | |||
1001 | */ | 975 | */ |
1002 | bus_dma_segment_t stack_sg; | 976 | bus_dma_segment_t stack_sg; |
1003 | 977 | ||
1004 | stack_sg.ds_addr = map->bus_addr; | 978 | stack_sg.ds_addr = map; |
1005 | stack_sg.ds_len = dmat->maxsize; | 979 | stack_sg.ds_len = dmat->maxsize; |
1006 | cb(cb_arg, &stack_sg, /*nseg*/1, /*error*/0); | 980 | cb(cb_arg, &stack_sg, /*nseg*/1, /*error*/0); |
1007 | return (0); | 981 | return (0); |
@@ -1010,12 +984,6 @@ ahc_dmamap_load(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map, | |||
1010 | void | 984 | void |
1011 | ahc_dmamap_destroy(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map) | 985 | ahc_dmamap_destroy(struct ahc_softc *ahc, bus_dma_tag_t dmat, bus_dmamap_t map) |
1012 | { | 986 | { |
1013 | /* | ||
1014 | * The map may is NULL in our < 2.3.X implementation. | ||
1015 | * Now it's 2.6.5, but just in case... | ||
1016 | */ | ||
1017 | BUG_ON(map == NULL); | ||
1018 | free(map, M_DEVBUF); | ||
1019 | } | 987 | } |
1020 | 988 | ||
1021 | int | 989 | int |
@@ -1382,7 +1350,6 @@ ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg) | |||
1382 | TAILQ_INIT(&ahc->platform_data->completeq); | 1350 | TAILQ_INIT(&ahc->platform_data->completeq); |
1383 | TAILQ_INIT(&ahc->platform_data->device_runq); | 1351 | TAILQ_INIT(&ahc->platform_data->device_runq); |
1384 | ahc->platform_data->irq = AHC_LINUX_NOIRQ; | 1352 | ahc->platform_data->irq = AHC_LINUX_NOIRQ; |
1385 | ahc->platform_data->hw_dma_mask = 0xFFFFFFFF; | ||
1386 | ahc_lockinit(ahc); | 1353 | ahc_lockinit(ahc); |
1387 | init_timer(&ahc->platform_data->completeq_timer); | 1354 | init_timer(&ahc->platform_data->completeq_timer); |
1388 | ahc->platform_data->completeq_timer.data = (u_long)ahc; | 1355 | ahc->platform_data->completeq_timer.data = (u_long)ahc; |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index 752022e4d4d4..9cfb46b4b15f 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h | |||
@@ -174,11 +174,7 @@ struct ahc_linux_dma_tag | |||
174 | }; | 174 | }; |
175 | typedef struct ahc_linux_dma_tag* bus_dma_tag_t; | 175 | typedef struct ahc_linux_dma_tag* bus_dma_tag_t; |
176 | 176 | ||
177 | struct ahc_linux_dmamap | 177 | typedef dma_addr_t bus_dmamap_t; |
178 | { | ||
179 | dma_addr_t bus_addr; | ||
180 | }; | ||
181 | typedef struct ahc_linux_dmamap* bus_dmamap_t; | ||
182 | 178 | ||
183 | typedef int bus_dma_filter_t(void*, dma_addr_t); | 179 | typedef int bus_dma_filter_t(void*, dma_addr_t); |
184 | typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int); | 180 | typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int); |
@@ -479,7 +475,6 @@ struct ahc_platform_data { | |||
479 | uint32_t irq; /* IRQ for this adapter */ | 475 | uint32_t irq; /* IRQ for this adapter */ |
480 | uint32_t bios_address; | 476 | uint32_t bios_address; |
481 | uint32_t mem_busaddr; /* Mem Base Addr */ | 477 | uint32_t mem_busaddr; /* Mem Base Addr */ |
482 | uint64_t hw_dma_mask; | ||
483 | ahc_linux_softc_flags flags; | 478 | ahc_linux_softc_flags flags; |
484 | }; | 479 | }; |
485 | 480 | ||
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index 886f92f91846..2a0ebce83e7a 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | |||
@@ -221,13 +221,11 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
221 | && ahc_linux_get_memsize() > 0x80000000 | 221 | && ahc_linux_get_memsize() > 0x80000000 |
222 | && pci_set_dma_mask(pdev, mask_39bit) == 0) { | 222 | && pci_set_dma_mask(pdev, mask_39bit) == 0) { |
223 | ahc->flags |= AHC_39BIT_ADDRESSING; | 223 | ahc->flags |= AHC_39BIT_ADDRESSING; |
224 | ahc->platform_data->hw_dma_mask = mask_39bit; | ||
225 | } else { | 224 | } else { |
226 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { | 225 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { |
227 | printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n"); | 226 | printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n"); |
228 | return (-ENODEV); | 227 | return (-ENODEV); |
229 | } | 228 | } |
230 | ahc->platform_data->hw_dma_mask = DMA_32BIT_MASK; | ||
231 | } | 229 | } |
232 | ahc->dev_softc = pci; | 230 | ahc->dev_softc = pci; |
233 | error = ahc_pci_config(ahc, entry); | 231 | error = ahc_pci_config(ahc, entry); |