| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bat.h,v 1.12 2008/04/28 20:23:32 martin Exp $ */ | | 1 | /* $NetBSD: bat.h,v 1.13 2009/07/21 07:08:57 nisimura Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe. | | 8 | * by Jason R. Thorpe. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -53,27 +53,27 @@ | | | @@ -53,27 +53,27 @@ |
53 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 53 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
54 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | | 54 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | | 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
56 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | | 56 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
57 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | 57 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
58 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | 58 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
59 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | | 59 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
60 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 60 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
61 | */ | | 61 | */ |
62 | | | 62 | |
63 | #ifndef _POWERPC_OEA_BAT_H_ | | 63 | #ifndef _POWERPC_OEA_BAT_H_ |
64 | #define _POWERPC_OEA_BAT_H_ | | 64 | #define _POWERPC_OEA_BAT_H_ |
65 | | | 65 | |
66 | #ifndef _LOCORE | | 66 | #if defined(_KERNEL) && !defined(_LOCORE) |
67 | struct bat { | | 67 | struct bat { |
68 | register_t batu; | | 68 | register_t batu; |
69 | register_t batl; | | 69 | register_t batl; |
70 | }; | | 70 | }; |
71 | #endif | | 71 | #endif |
72 | | | 72 | |
73 | /* Lower BAT bits (all but PowerPC 601): */ | | 73 | /* Lower BAT bits (all but PowerPC 601): */ |
74 | #define BAT_RPN (~0x1ffff) /* physical block start */ | | 74 | #define BAT_RPN (~0x1ffff) /* physical block start */ |
75 | #define BAT_XPN 0x00000e00 /* eXtended physical page number (0-2) */ | | 75 | #define BAT_XPN 0x00000e00 /* eXtended physical page number (0-2) */ |
76 | #define BAT_W 0x00000040 /* 1 = write-through, 0 = write-back */ | | 76 | #define BAT_W 0x00000040 /* 1 = write-through, 0 = write-back */ |
77 | #define BAT_I 0x00000020 /* cache inhibit */ | | 77 | #define BAT_I 0x00000020 /* cache inhibit */ |
78 | #define BAT_M 0x00000010 /* memory coherency enable */ | | 78 | #define BAT_M 0x00000010 /* memory coherency enable */ |
79 | #define BAT_G 0x00000008 /* guarded region (not on 601) */ | | 79 | #define BAT_G 0x00000008 /* guarded region (not on 601) */ |
| @@ -186,26 +186,24 @@ struct bat { | | | @@ -186,26 +186,24 @@ struct bat { |
186 | (((va) & BAT601_BLPI) | (wim) | (key) | (pp)) | | 186 | (((va) & BAT601_BLPI) | (wim) | (key) | (pp)) |
187 | | | 187 | |
188 | #define BATL601(pa, size, v) \ | | 188 | #define BATL601(pa, size, v) \ |
189 | (((pa) & BAT601_PBN) | (v) | (size)) | | 189 | (((pa) & BAT601_PBN) | (v) | (size)) |
190 | | | 190 | |
191 | #define BAT601_VA_MATCH_P(batu, batl, va) \ | | 191 | #define BAT601_VA_MATCH_P(batu, batl, va) \ |
192 | (((~(((batl)&BAT601_BSM)<<17))&(va)&BAT601_BLPI)==((batu)&BAT601_BLPI)) | | 192 | (((~(((batl)&BAT601_BSM)<<17))&(va)&BAT601_BLPI)==((batu)&BAT601_BLPI)) |
193 | | | 193 | |
194 | #define BAT601_VALID_P(batl) \ | | 194 | #define BAT601_VALID_P(batl) \ |
195 | ((batl) & BAT601_V) | | 195 | ((batl) & BAT601_V) |
196 | | | 196 | |
197 | #define BAT_VA2IDX(va) ((va) >> ADDR_SR_SHFT) | | 197 | #define BAT_VA2IDX(va) ((va) >> ADDR_SR_SHFT) |
198 | | | 198 | |
199 | #ifdef _KERNEL | | 199 | #if defined(_KERNEL) && !defined(_LOCORE) |
200 | #ifndef _LOCORE | | | |
201 | void oea_batinit(paddr_t, ...); | | 200 | void oea_batinit(paddr_t, ...); |
202 | void oea_iobat_add(paddr_t, register_t); | | 201 | void oea_iobat_add(paddr_t, register_t); |
203 | void oea_iobat_remove(paddr_t); | | 202 | void oea_iobat_remove(paddr_t); |
204 | | | 203 | |
205 | #if !defined (PPC_OEA64) | | 204 | #if !defined (PPC_OEA64) |
206 | extern struct bat battable[]; | | 205 | extern struct bat battable[]; |
207 | #endif /* PPC_OEA */ | | 206 | #endif /* PPC_OEA */ |
208 | #endif | | 207 | #endif |
209 | #endif | | | |
210 | | | 208 | |
211 | #endif /* _POWERPC_OEA_BAT_H_ */ | | 209 | #endif /* _POWERPC_OEA_BAT_H_ */ |