Merge branch 'linux-2.6'
This commit is contained in:
@@ -297,6 +297,31 @@ int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name)
|
||||
}
|
||||
EXPORT_SYMBOL(pcim_iomap_regions);
|
||||
|
||||
/**
|
||||
* pcim_iomap_regions_request_all - Request all BARs and iomap specified ones
|
||||
* @pdev: PCI device to map IO resources for
|
||||
* @mask: Mask of BARs to iomap
|
||||
* @name: Name used when requesting regions
|
||||
*
|
||||
* Request all PCI BARs and iomap regions specified by @mask.
|
||||
*/
|
||||
int pcim_iomap_regions_request_all(struct pci_dev *pdev, u16 mask,
|
||||
const char *name)
|
||||
{
|
||||
int request_mask = ((1 << 6) - 1) & ~mask;
|
||||
int rc;
|
||||
|
||||
rc = pci_request_selected_regions(pdev, request_mask, name);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = pcim_iomap_regions(pdev, mask, name);
|
||||
if (rc)
|
||||
pci_release_selected_regions(pdev, request_mask);
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(pcim_iomap_regions_request_all);
|
||||
|
||||
/**
|
||||
* pcim_iounmap_regions - Unmap and release PCI BARs
|
||||
* @pdev: PCI device to map IO resources for
|
||||
|
||||
+1
-1
@@ -256,7 +256,7 @@ EXPORT_SYMBOL(ioport_unmap);
|
||||
* */
|
||||
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
|
||||
{
|
||||
unsigned long start = pci_resource_start(dev, bar);
|
||||
resource_size_t start = pci_resource_start(dev, bar);
|
||||
unsigned long len = pci_resource_len(dev, bar);
|
||||
unsigned long flags = pci_resource_flags(dev, bar);
|
||||
|
||||
|
||||
+16
-14
@@ -310,7 +310,9 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir)
|
||||
start_dma_addr = virt_to_bus(io_tlb_start) & mask;
|
||||
|
||||
offset_slots = ALIGN(start_dma_addr, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
|
||||
max_slots = ALIGN(mask + 1, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
|
||||
max_slots = mask + 1
|
||||
? ALIGN(mask + 1, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT
|
||||
: 1UL << (BITS_PER_LONG - IO_TLB_SHIFT);
|
||||
|
||||
/*
|
||||
* For mappings greater than a page, we limit the stride (and
|
||||
@@ -333,16 +335,18 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir)
|
||||
index = ALIGN(io_tlb_index, stride);
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
|
||||
while (is_span_boundary(index, nslots, offset_slots,
|
||||
max_slots)) {
|
||||
index += stride;
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
}
|
||||
wrap = index;
|
||||
|
||||
do {
|
||||
while (is_span_boundary(index, nslots, offset_slots,
|
||||
max_slots)) {
|
||||
index += stride;
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
if (index == wrap)
|
||||
goto not_found;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we find a slot that indicates we have 'nslots'
|
||||
* number of contiguous buffers, we allocate the
|
||||
@@ -367,14 +371,12 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir)
|
||||
|
||||
goto found;
|
||||
}
|
||||
do {
|
||||
index += stride;
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
} while (is_span_boundary(index, nslots, offset_slots,
|
||||
max_slots));
|
||||
index += stride;
|
||||
if (index >= io_tlb_nslabs)
|
||||
index = 0;
|
||||
} while (index != wrap);
|
||||
|
||||
not_found:
|
||||
spin_unlock_irqrestore(&io_tlb_lock, flags);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user