Annotation of sys/arch/sparc/sparc/iommureg.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: iommureg.h,v 1.6 1998/05/10 21:11:53 art Exp $ */
2: /* $NetBSD: iommureg.h,v 1.5 1998/05/04 23:16:59 pk Exp $ */
3:
4: /*
5: * Copyright (c) 1996
6: * The President and Fellows of Harvard College. All rights reserved.
7: * Copyright (c) 1995 Paul Kranenburg
8: *
9: * Redistribution and use in source and binary forms, with or without
10: * modification, are permitted provided that the following conditions
11: * are met:
12: * 1. Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in the
16: * documentation and/or other materials provided with the distribution.
17: * 3. All advertising materials mentioning features or use of this software
18: * must display the following acknowledgement:
19: * This product includes software developed by Aaron Brown and
20: * Harvard University.
21: * This product includes software developed by Paul Kranenburg.
22: * 4. Neither the name of the University nor the names of its contributors
23: * may be used to endorse or promote products derived from this software
24: * without specific prior written permission.
25: *
26: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36: * SUCH DAMAGE.
37: *
38: */
39:
40: struct iommureg {
41: u_int32_t io_cr; /* IOMMU control register */
42: u_int32_t io_bar; /* IOMMU PTE base register */
43: u_int32_t io_fill1[3];
44: u_int32_t io_flashclear; /* Flush all TLB entries */
45: u_int32_t io_flushpage; /* Flush page from TLB */
46: };
47:
48: #define IOMMU_CTL_IMPL 0xf0000000
49: #define IOMMU_CTL_VER 0x0f000000
50: #define IOMMU_CTL_RSVD1 0x00ffffe0
51: #define IOMMU_CTL_RANGE 0x0000001c
52: #define IOMMU_CTL_RANGESHFT 2
53: #define IOMMU_CTL_RSVD2 0x00000002
54: #define IOMMU_CTL_ME 0x00000001
55:
56: #define IOMMU_BAR_IBA 0xfffffc00
57: #define IOMMU_BAR_IBASHFT 10
58:
59: /* Flushpage fields */
60: #define IOMMU_FLPG_VADDR 0xfffff000
61: #define IOMMU_FLUSH_MASK 0xfffff000
62:
63: /*
64: * A few empty cycles after touching the IOMMU registers seems to
65: * avoid utter lossage on some machines (SS4s & SS5s) where our caller
66: * would see some of its local (`%lx') registers trashed.
67: */
68: #define IOMMU_FLUSHPAGE(sc, va) do { \
69: (sc)->sc_reg->io_flushpage = (va) & IOMMU_FLUSH_MASK; \
70: __asm("nop;nop;nop;"); \
71: } while (0);
72: #define IOMMU_FLUSHALL(sc) do { \
73: (sc)->sc_reg->io_flashclear = 0; \
74: __asm("nop;nop;nop;"); \
75: } while (0)
76:
77: /* to pte.h ? */
78: typedef u_int32_t iopte_t;
79:
80: #define IOPTE_PPN 0xffffff00 /* PA<35:12> */
81: #define IOPTE_C 0x00000080 /* cacheable */
82: #define IOPTE_W 0x00000004 /* writeable */
83: #define IOPTE_V 0x00000002 /* valid */
84: #define IOPTE_WAZ 0x00000001 /* must write as zero */
85:
86: #define IOPTE_PPNSHFT 8 /* shift to get ppn from IOPTE */
87: #define IOPTE_PPNPASHFT 4 /* shift to get pa from ioppn */
88:
89: #define IOPTE_BITS "\20\10C\3W\2V\1WAZ"
90:
CVSweb