iommuvar.h revision 1.9.4.3 1 1.9.4.3 nathanw /* $NetBSD: iommuvar.h,v 1.9.4.3 2002/04/01 07:43:02 nathanw Exp $ */
2 1.9.4.2 nathanw
3 1.9.4.2 nathanw /*
4 1.9.4.2 nathanw * Copyright (c) 1999 Matthew R. Green
5 1.9.4.2 nathanw * All rights reserved.
6 1.9.4.2 nathanw *
7 1.9.4.2 nathanw * Redistribution and use in source and binary forms, with or without
8 1.9.4.2 nathanw * modification, are permitted provided that the following conditions
9 1.9.4.2 nathanw * are met:
10 1.9.4.2 nathanw * 1. Redistributions of source code must retain the above copyright
11 1.9.4.2 nathanw * notice, this list of conditions and the following disclaimer.
12 1.9.4.2 nathanw * 2. Redistributions in binary form must reproduce the above copyright
13 1.9.4.2 nathanw * notice, this list of conditions and the following disclaimer in the
14 1.9.4.2 nathanw * documentation and/or other materials provided with the distribution.
15 1.9.4.2 nathanw * 3. The name of the author may not be used to endorse or promote products
16 1.9.4.2 nathanw * derived from this software without specific prior written permission.
17 1.9.4.2 nathanw *
18 1.9.4.2 nathanw * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 1.9.4.2 nathanw * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 1.9.4.2 nathanw * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 1.9.4.2 nathanw * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 1.9.4.2 nathanw * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 1.9.4.2 nathanw * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 1.9.4.2 nathanw * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 1.9.4.2 nathanw * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 1.9.4.2 nathanw * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 1.9.4.2 nathanw * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 1.9.4.2 nathanw * SUCH DAMAGE.
29 1.9.4.2 nathanw */
30 1.9.4.2 nathanw
31 1.9.4.2 nathanw #ifndef _SPARC64_DEV_IOMMUVAR_H_
32 1.9.4.2 nathanw #define _SPARC64_DEV_IOMMUVAR_H_
33 1.9.4.2 nathanw
34 1.9.4.2 nathanw /*
35 1.9.4.2 nathanw * per-IOMMU state
36 1.9.4.2 nathanw */
37 1.9.4.2 nathanw struct iommu_state {
38 1.9.4.2 nathanw paddr_t is_ptsb; /* TSB physical address */
39 1.9.4.2 nathanw int64_t *is_tsb; /* TSB virtual address */
40 1.9.4.2 nathanw int is_tsbsize; /* 0 = 8K, ... */
41 1.9.4.2 nathanw u_int is_dvmabase;
42 1.9.4.2 nathanw u_int is_dvmaend;
43 1.9.4.2 nathanw int64_t is_cr; /* IOMMU control regiter value */
44 1.9.4.2 nathanw struct extent *is_dvmamap; /* DVMA map for this instance */
45 1.9.4.2 nathanw
46 1.9.4.2 nathanw paddr_t is_flushpa; /* used to flush the SBUS */
47 1.9.4.2 nathanw /* Needs to be volatile or egcs optimizes away loads */
48 1.9.4.2 nathanw volatile int64_t is_flush[2];
49 1.9.4.2 nathanw
50 1.9.4.3 nathanw /* copies of our piarents state, to allow us to be self contained */
51 1.9.4.2 nathanw bus_space_tag_t is_bustag; /* our bus tag */
52 1.9.4.3 nathanw bus_space_handle_t is_iommu; /* IOMMU registers */
53 1.9.4.3 nathanw bus_space_handle_t is_sb[2]; /* streaming buffer(s) */
54 1.9.4.3 nathanw int is_sbvalid[2];
55 1.9.4.2 nathanw };
56 1.9.4.2 nathanw
57 1.9.4.2 nathanw /* interfaces for PCI/SBUS code */
58 1.9.4.2 nathanw void iommu_init __P((char *, struct iommu_state *, int, u_int32_t));
59 1.9.4.2 nathanw void iommu_reset __P((struct iommu_state *));
60 1.9.4.2 nathanw void iommu_enter __P((struct iommu_state *, vaddr_t, int64_t, int));
61 1.9.4.2 nathanw void iommu_remove __P((struct iommu_state *, vaddr_t, size_t));
62 1.9.4.2 nathanw paddr_t iommu_extract __P((struct iommu_state *, vaddr_t));
63 1.9.4.2 nathanw
64 1.9.4.2 nathanw int iommu_dvmamap_load __P((bus_dma_tag_t, struct iommu_state *,
65 1.9.4.2 nathanw bus_dmamap_t, void *, bus_size_t, struct proc *, int));
66 1.9.4.2 nathanw void iommu_dvmamap_unload __P((bus_dma_tag_t, struct iommu_state *,
67 1.9.4.2 nathanw bus_dmamap_t));
68 1.9.4.2 nathanw int iommu_dvmamap_load_raw __P((bus_dma_tag_t, struct iommu_state *,
69 1.9.4.2 nathanw bus_dmamap_t, bus_dma_segment_t *, int, int, bus_size_t));
70 1.9.4.2 nathanw void iommu_dvmamap_sync __P((bus_dma_tag_t, struct iommu_state *,
71 1.9.4.2 nathanw bus_dmamap_t, bus_addr_t, bus_size_t, int));
72 1.9.4.2 nathanw int iommu_dvmamem_alloc __P((bus_dma_tag_t, struct iommu_state *,
73 1.9.4.2 nathanw bus_size_t, bus_size_t, bus_size_t, bus_dma_segment_t *,
74 1.9.4.2 nathanw int, int *, int));
75 1.9.4.2 nathanw void iommu_dvmamem_free __P((bus_dma_tag_t, struct iommu_state *,
76 1.9.4.2 nathanw bus_dma_segment_t *, int));
77 1.9.4.2 nathanw int iommu_dvmamem_map __P((bus_dma_tag_t, struct iommu_state *,
78 1.9.4.2 nathanw bus_dma_segment_t *, int, size_t, caddr_t *, int));
79 1.9.4.2 nathanw void iommu_dvmamem_unmap __P((bus_dma_tag_t, struct iommu_state *,
80 1.9.4.2 nathanw caddr_t, size_t));
81 1.9.4.2 nathanw
82 1.9.4.2 nathanw #endif /* _SPARC64_DEV_IOMMUVAR_H_ */
83