booke_stubs.c revision 1.9 1 /* $NetBSD: booke_stubs.c,v 1.9 2011/06/30 00:52:58 matt Exp $ */
2 /*-
3 * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects
8 * Agency and which was developed by Matt Thomas of 3am Software Foundry.
9 *
10 * This material is based upon work supported by the Defense Advanced Research
11 * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under
12 * Contract No. N66001-09-C-2073.
13 * Approved for Public Release, Distribution Unlimited
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
25 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
28 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37 #include <sys/cdefs.h>
38
39 __KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.9 2011/06/30 00:52:58 matt Exp $");
40
41 #include <sys/param.h>
42 #include <sys/cpu.h>
43
44 #include <powerpc/instr.h>
45 #include <powerpc/booke/cpuvar.h>
46
47 #define __stub __section(".stub") __noprofile
48
49 void tlb_set_asid(tlb_asid_t) __stub;
50
51 void
52 tlb_set_asid(tlb_asid_t asid)
53 {
54 (*cpu_md_ops.md_tlb_ops->md_tlb_set_asid)(asid);
55 }
56
57 tlb_asid_t tlb_get_asid(void) __stub;
58
59 tlb_asid_t
60 tlb_get_asid(void)
61 {
62 return (*cpu_md_ops.md_tlb_ops->md_tlb_get_asid)();
63 }
64
65 void tlb_invalidate_all(void) __stub;
66
67 void
68 tlb_invalidate_all(void)
69 {
70 (*cpu_md_ops.md_tlb_ops->md_tlb_invalidate_all)();
71 }
72
73 void tlb_invalidate_globals(void) __stub;
74
75 void
76 tlb_invalidate_globals(void)
77 {
78 (*cpu_md_ops.md_tlb_ops->md_tlb_invalidate_globals)();
79 }
80
81 void tlb_invalidate_asids(tlb_asid_t, tlb_asid_t) __stub;
82
83 void
84 tlb_invalidate_asids(tlb_asid_t asid_lo, tlb_asid_t asid_hi)
85 {
86 (*cpu_md_ops.md_tlb_ops->md_tlb_invalidate_asids)(asid_lo, asid_hi);
87 }
88
89 void tlb_invalidate_addr(vaddr_t, tlb_asid_t) __stub;
90
91 void
92 tlb_invalidate_addr(vaddr_t va, tlb_asid_t asid)
93 {
94 (*cpu_md_ops.md_tlb_ops->md_tlb_invalidate_addr)(va, asid);
95 }
96
97 bool tlb_update_addr(vaddr_t, tlb_asid_t, pt_entry_t, bool) __stub;
98
99 bool
100 tlb_update_addr(vaddr_t va, tlb_asid_t asid, pt_entry_t pte, bool insert_p)
101 {
102 return (*cpu_md_ops.md_tlb_ops->md_tlb_update_addr)(va, asid, pte, insert_p);
103 }
104
105 void tlb_read_entry(size_t, struct tlbmask *) __stub;
106
107 void
108 tlb_read_entry(size_t pos, struct tlbmask *tlb)
109 {
110 (*cpu_md_ops.md_tlb_ops->md_tlb_read_entry)(pos, tlb);
111 }
112
113 void tlb_write_entry(size_t, const struct tlbmask *) __stub;
114
115 void
116 tlb_write_entry(size_t pos, const struct tlbmask *tlb)
117 {
118 (*cpu_md_ops.md_tlb_ops->md_tlb_write_entry)(pos, tlb);
119 }
120
121 u_int tlb_record_asids(u_long *) __stub;
122
123 u_int
124 tlb_record_asids(u_long *bitmap)
125 {
126 return (*cpu_md_ops.md_tlb_ops->md_tlb_record_asids)(bitmap);
127 }
128
129 void tlb_dump(void (*)(const char *, ...)) __stub;
130
131 void
132 tlb_dump(void (*pr)(const char *, ...))
133 {
134 (*cpu_md_ops.md_tlb_ops->md_tlb_dump)(pr);
135 }
136
137 void tlb_walk(void *, bool (*)(void *, vaddr_t, uint32_t, uint32_t))
138 __stub;
139
140 void
141 tlb_walk(void *ctx, bool (*func)(void *, vaddr_t, uint32_t, uint32_t))
142 {
143 (*cpu_md_ops.md_tlb_ops->md_tlb_walk)(ctx, func);
144 }
145
146 void *tlb_mapiodev(paddr_t, psize_t, bool) __stub;
147
148 void *
149 tlb_mapiodev(paddr_t pa, psize_t len, bool prefetchable)
150 {
151 return (*cpu_md_ops.md_tlb_io_ops->md_tlb_mapiodev)(pa, len, prefetchable);
152 }
153
154 void tlb_unmapiodev(vaddr_t, vsize_t) __stub;
155
156 void
157 tlb_unmapiodev(vaddr_t va, vsize_t len)
158 {
159 (*cpu_md_ops.md_tlb_io_ops->md_tlb_unmapiodev)(va, len);
160 }
161
162 int tlb_ioreserve(vaddr_t, vsize_t, uint32_t) __stub;
163
164 int
165 tlb_ioreserve(vaddr_t va, vsize_t len, uint32_t pte)
166 {
167 return (*cpu_md_ops.md_tlb_io_ops->md_tlb_ioreserve)(va, len, pte);
168 }
169
170 int tlb_iorelease(vaddr_t) __stub;
171
172 int
173 tlb_iorelease(vaddr_t va)
174 {
175 return (*cpu_md_ops.md_tlb_io_ops->md_tlb_iorelease)(va);
176 }
177