Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48458
b: refs/heads/master
c: 310adfd
h: refs/heads/master
v: v3
  • Loading branch information
Muli Ben-Yehuda authored and Andi Kleen committed Feb 13, 2007
1 parent 9c0017b commit 71706aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 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: 2fa8a050a0026eadbb39a2f281011991e00fe29a
refs/heads/master: 310adfdd9153f6ae818981a38a48dd2330990d8d
17 changes: 15 additions & 2 deletions trunk/arch/x86_64/kernel/pci-calgary.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ static const unsigned long phb_debug_offsets[] = {

#define PHB_DEBUG_STUFF_OFFSET 0x0020

#define EMERGENCY_PAGES 32 /* = 128KB */

unsigned int specified_table_size = TCE_TABLE_SIZE_UNSPECIFIED;
static int translate_empty_slots __read_mostly = 0;
static int calgary_detected __read_mostly = 0;
Expand Down Expand Up @@ -296,6 +298,16 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
{
unsigned long entry;
unsigned long badbit;
unsigned long badend;

/* were we called with bad_dma_address? */
badend = bad_dma_address + (EMERGENCY_PAGES * PAGE_SIZE);
if (unlikely((dma_addr >= bad_dma_address) && (dma_addr < badend))) {
printk(KERN_ERR "Calgary: driver tried unmapping bad DMA "
"address 0x%Lx\n", dma_addr);
WARN_ON(1);
return;
}

entry = dma_addr >> PAGE_SHIFT;

Expand Down Expand Up @@ -656,8 +668,8 @@ static void __init calgary_reserve_regions(struct pci_dev *dev)
u64 start;
struct iommu_table *tbl = dev->sysdata;

/* reserve bad_dma_address in case it's a legal address */
iommu_range_reserve(tbl, bad_dma_address, 1);
/* reserve EMERGENCY_PAGES from bad_dma_address and up */
iommu_range_reserve(tbl, bad_dma_address, EMERGENCY_PAGES);

/* avoid the BIOS/VGA first 640KB-1MB region */
start = (640 * 1024);
Expand Down Expand Up @@ -1176,6 +1188,7 @@ int __init calgary_iommu_init(void)
}

force_iommu = 1;
bad_dma_address = 0x0;
dma_ops = &calgary_dma_ops;

return 0;
Expand Down

0 comments on commit 71706aa

Please sign in to comment.