1 /* $NetBSD: booke_stubs.c,v 1.12 2021/10/02 14:28:04 skrll 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 __KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.12 2021/10/02 14:28:04 skrll 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, struct pmap *) __stub;
49
50 void
tlb_set_asid(tlb_asid_t asid,struct pmap * pm)51 tlb_set_asid(tlb_asid_t asid, struct pmap *pm)
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
tlb_get_asid(void)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
tlb_invalidate_all(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
tlb_invalidate_globals(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
tlb_invalidate_asids(tlb_asid_t asid_lo,tlb_asid_t asid_hi)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
tlb_invalidate_addr(vaddr_t va,tlb_asid_t asid)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
tlb_update_addr(vaddr_t va,tlb_asid_t asid,pt_entry_t pte,bool insert_p)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
tlb_read_entry(size_t pos,struct tlbmask * tlb)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
tlb_write_entry(size_t pos,const struct tlbmask * tlb)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 *, tlb_asid_t) __stub;
121
122 u_int
tlb_record_asids(u_long * bitmap,tlb_asid_t asid_max)123 tlb_record_asids(u_long *bitmap, tlb_asid_t asid_max)
124 {
125 return (*cpu_md_ops.md_tlb_ops->md_tlb_record_asids)(bitmap, asid_max);
126 }
127
128 void tlb_dump(void (*)(const char *, ...)) __stub;
129
130 void
tlb_dump(void (* pr)(const char *,...))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
tlb_walk(void * ctx,bool (* func)(void *,vaddr_t,uint32_t,uint32_t))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, bool) __stub;
146
147 void *
tlb_mapiodev(paddr_t pa,psize_t len,bool prefetchable)148 tlb_mapiodev(paddr_t pa, psize_t len, bool prefetchable)
149 {
150 return (*cpu_md_ops.md_tlb_io_ops->md_tlb_mapiodev)(pa, len, prefetchable);
151 }
152
153 void tlb_unmapiodev(vaddr_t, vsize_t) __stub;
154
155 void
tlb_unmapiodev(vaddr_t va,vsize_t len)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
tlb_ioreserve(vaddr_t va,vsize_t len,uint32_t pte)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
tlb_iorelease(vaddr_t va)172 tlb_iorelease(vaddr_t va)
173 {
174 return (*cpu_md_ops.md_tlb_io_ops->md_tlb_iorelease)(va);
175 }
176