Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* $Id: iommu_common.h,v 1.5 2001/12/11 09:41:01 davem Exp $ |
2 | * iommu_common.h: UltraSparc SBUS/PCI common iommu declarations. | |
3 | * | |
4 | * Copyright (C) 1999 David S. Miller (davem@redhat.com) | |
5 | */ | |
6 | ||
7 | #include <linux/kernel.h> | |
8 | #include <linux/types.h> | |
9 | #include <linux/sched.h> | |
10 | #include <linux/mm.h> | |
24c31eed | 11 | #include <linux/scatterlist.h> |
1da177e4 LT |
12 | |
13 | #include <asm/iommu.h> | |
14 | #include <asm/scatterlist.h> | |
15 | ||
16 | /* | |
17 | * These give mapping size of each iommu pte/tlb. | |
18 | */ | |
19 | #define IO_PAGE_SHIFT 13 | |
20 | #define IO_PAGE_SIZE (1UL << IO_PAGE_SHIFT) | |
21 | #define IO_PAGE_MASK (~(IO_PAGE_SIZE-1)) | |
22 | #define IO_PAGE_ALIGN(addr) (((addr)+IO_PAGE_SIZE-1)&IO_PAGE_MASK) | |
23 | ||
24 | #define IO_TSB_ENTRIES (128*1024) | |
25 | #define IO_TSB_SIZE (IO_TSB_ENTRIES * 8) | |
26 | ||
27 | /* | |
28 | * This is the hardwired shift in the iotlb tag/data parts. | |
29 | */ | |
30 | #define IOMMU_PAGE_SHIFT 13 | |
31 | ||
32 | /* You are _strongly_ advised to enable the following debugging code | |
33 | * any time you make changes to the sg code below, run it for a while | |
34 | * with filesystems mounted read-only before buying the farm... -DaveM | |
35 | */ | |
36 | #undef VERIFY_SG | |
37 | ||
38 | #ifdef VERIFY_SG | |
39 | extern void verify_sglist(struct scatterlist *sg, int nents, iopte_t *iopte, int npages); | |
40 | #endif | |
41 | ||
42 | /* Two addresses are "virtually contiguous" if and only if: | |
43 | * 1) They are equal, or... | |
44 | * 2) They are both on a page boundary | |
45 | */ | |
46 | #define VCONTIG(__X, __Y) (((__X) == (__Y)) || \ | |
47 | (((__X) | (__Y)) << (64UL - PAGE_SHIFT)) == 0UL) | |
48 | ||
49 | extern unsigned long prepare_sg(struct scatterlist *sg, int nents); |