File: /usr/src/linux/arch/sparc64/kernel/iommu_common.h

1     /* $Id: iommu_common.h,v 1.3 2001/08/24 19:36:58 kanoj 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     
10     #include <asm/page.h>
11     #include <asm/iommu.h>
12     #include <asm/scatterlist.h>
13     
14     /*
15      * These give mapping size of each iommu pte/tlb.
16      */
17     #define IO_PAGE_SHIFT			13
18     #define IO_PAGE_SIZE			(1UL << IO_PAGE_SHIFT)
19     #define IO_PAGE_MASK			(~(IO_PAGE_SIZE-1))
20     #define IO_PAGE_ALIGN(addr)		(((addr)+IO_PAGE_SIZE-1)&IO_PAGE_MASK)
21     
22     #define IO_TSB_ENTRIES			(128*1024)
23     #define IO_TSB_SIZE			(IO_TSB_ENTRIES * 8)
24     
25     /*
26      * This is the hardwired shift in the iotlb tag/data parts.
27      */
28     #define IOMMU_PAGE_SHIFT		13
29     
30     /* You are _strongly_ advised to enable the following debugging code
31      * any time you make changes to the sg code below, run it for a while
32      * with filesystems mounted read-only before buying the farm... -DaveM
33      */
34     #undef VERIFY_SG
35     
36     #ifdef VERIFY_SG
37     int verify_lengths(struct scatterlist *sg, int nents, int npages);
38     int verify_one_map(struct scatterlist *dma_sg, struct scatterlist **__sg, int nents, iopte_t **__iopte);
39     int verify_maps(struct scatterlist *sg, int nents, iopte_t *iopte);
40     void verify_sglist(struct scatterlist *sg, int nents, iopte_t *iopte, int npages);
41     #endif
42     
43     /* Two addresses are "virtually contiguous" if and only if:
44      * 1) They are equal, or...
45      * 2) They are both on a page boundry
46      */
47     #define VCONTIG(__X, __Y)	(((__X) == (__Y)) || \
48     				 (((__X) | (__Y)) << (64UL - PAGE_SHIFT)) == 0UL)
49     
50     unsigned long prepare_sg(struct scatterlist *sg, int nents);
51