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