diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/sn/pci/tioca_provider.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c index 35b2a27d2e7..efb454534e5 100644 --- a/arch/ia64/sn/pci/tioca_provider.c +++ b/arch/ia64/sn/pci/tioca_provider.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
11 | #include <linux/pci.h> | 11 | #include <linux/pci.h> |
12 | #include <linux/bitmap.h> | ||
12 | #include <asm/sn/sn_sal.h> | 13 | #include <asm/sn/sn_sal.h> |
13 | #include <asm/sn/addrs.h> | 14 | #include <asm/sn/addrs.h> |
14 | #include <asm/sn/io.h> | 15 | #include <asm/sn/io.h> |
@@ -369,7 +370,7 @@ tioca_dma_d48(struct pci_dev *pdev, u64 paddr) | |||
369 | static dma_addr_t | 370 | static dma_addr_t |
370 | tioca_dma_mapped(struct pci_dev *pdev, unsigned long paddr, size_t req_size) | 371 | tioca_dma_mapped(struct pci_dev *pdev, unsigned long paddr, size_t req_size) |
371 | { | 372 | { |
372 | int i, ps, ps_shift, entry, entries, mapsize, last_entry; | 373 | int ps, ps_shift, entry, entries, mapsize; |
373 | u64 xio_addr, end_xio_addr; | 374 | u64 xio_addr, end_xio_addr; |
374 | struct tioca_common *tioca_common; | 375 | struct tioca_common *tioca_common; |
375 | struct tioca_kernel *tioca_kern; | 376 | struct tioca_kernel *tioca_kern; |
@@ -410,23 +411,13 @@ tioca_dma_mapped(struct pci_dev *pdev, unsigned long paddr, size_t req_size) | |||
410 | map = tioca_kern->ca_pcigart_pagemap; | 411 | map = tioca_kern->ca_pcigart_pagemap; |
411 | mapsize = tioca_kern->ca_pcigart_entries; | 412 | mapsize = tioca_kern->ca_pcigart_entries; |
412 | 413 | ||
413 | entry = find_first_zero_bit(map, mapsize); | 414 | entry = bitmap_find_next_zero_area(map, mapsize, 0, entries, 0); |
414 | while (entry < mapsize) { | 415 | if (entry >= mapsize) { |
415 | last_entry = find_next_bit(map, mapsize, entry); | ||
416 | |||
417 | if (last_entry - entry >= entries) | ||
418 | break; | ||
419 | |||
420 | entry = find_next_zero_bit(map, mapsize, last_entry); | ||
421 | } | ||
422 | |||
423 | if (entry > mapsize) { | ||
424 | kfree(ca_dmamap); | 416 | kfree(ca_dmamap); |
425 | goto map_return; | 417 | goto map_return; |
426 | } | 418 | } |
427 | 419 | ||
428 | for (i = 0; i < entries; i++) | 420 | bitmap_set(map, entry, entries); |
429 | set_bit(entry + i, map); | ||
430 | 421 | ||
431 | bus_addr = tioca_kern->ca_pciap_base + (entry * ps); | 422 | bus_addr = tioca_kern->ca_pciap_base + (entry * ps); |
432 | 423 | ||