Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 70963
b: refs/heads/master
c: d588ba8
h: refs/heads/master
i:
  70961: b93d37f
  70959: 2c88322
v: v3
  • Loading branch information
Muli Ben-Yehuda authored and Thomas Gleixner committed Oct 17, 2007
1 parent 706f205 commit 9928489
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 84e0fdb1754d066dd0a8b257de7299f392d1e727
refs/heads/master: d588ba8c09aa2516a06512d8ba065a05f9620ee0
16 changes: 11 additions & 5 deletions trunk/arch/x86/kernel/pci-calgary_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ static inline unsigned int num_dma_pages(unsigned long dma, unsigned int dmalen)
return npages;
}

static inline int translation_enabled(struct iommu_table *tbl)
{
/* only PHBs with translation enabled have an IOMMU table */
return (tbl != NULL);
}

static inline int translate_phb(struct pci_dev* dev)
{
int disabled = bus_info[dev->bus->number].translation_disabled;
Expand Down Expand Up @@ -388,7 +394,7 @@ static void calgary_unmap_sg(struct device *dev,
struct scatterlist *s;
int i;

if (!translate_phb(to_pci_dev(dev)))
if (!translate_enabled(tbl))
return;

for_each_sg(sglist, s, nelems, i) {
Expand Down Expand Up @@ -428,7 +434,7 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
unsigned long entry;
int i;

if (!translate_phb(to_pci_dev(dev)))
if (!translation_enabled(tbl))
return calgary_nontranslate_map_sg(dev, sg, nelems, direction);

for_each_sg(sg, s, nelems, i) {
Expand Down Expand Up @@ -474,7 +480,7 @@ static dma_addr_t calgary_map_single(struct device *dev, void *vaddr,
uaddr = (unsigned long)vaddr;
npages = num_dma_pages(uaddr, size);

if (translate_phb(to_pci_dev(dev)))
if (translation_enabled(tbl))
dma_handle = iommu_alloc(tbl, vaddr, npages, direction);
else
dma_handle = virt_to_bus(vaddr);
Expand All @@ -488,7 +494,7 @@ static void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle,
struct iommu_table *tbl = find_iommu_table(dev);
unsigned int npages;

if (!translate_phb(to_pci_dev(dev)))
if (!translation_enabled(tbl))
return;

npages = num_dma_pages(dma_handle, size);
Expand All @@ -513,7 +519,7 @@ static void* calgary_alloc_coherent(struct device *dev, size_t size,
goto error;
memset(ret, 0, size);

if (translate_phb(to_pci_dev(dev))) {
if (translation_enabled(tbl)) {
/* set up tces to cover the allocated range */
mapping = iommu_alloc(tbl, ret, npages, DMA_BIDIRECTIONAL);
if (mapping == bad_dma_address)
Expand Down

0 comments on commit 9928489

Please sign in to comment.