| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.h,v 1.21 2020/03/14 14:05:43 ad Exp $ */ | | 1 | /* $NetBSD: pmap.h,v 1.22 2023/09/28 06:19:19 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 2001 Wasabi Systems, Inc. | | 4 | * Copyright 2001 Wasabi Systems, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc. | | 7 | * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -59,27 +59,27 @@ | | | @@ -59,27 +59,27 @@ |
59 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 59 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
60 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | | 60 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
61 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | | 61 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
62 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | | 62 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
63 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | 63 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
64 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | 64 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
65 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | | 65 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
66 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 66 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
67 | */ | | 67 | */ |
68 | | | 68 | |
69 | #ifndef _IBM4XX_PMAP_H_ | | 69 | #ifndef _IBM4XX_PMAP_H_ |
70 | #define _IBM4XX_PMAP_H_ | | 70 | #define _IBM4XX_PMAP_H_ |
71 | | | 71 | |
72 | #ifdef _LOCORE | | 72 | #ifdef _LOCORE |
73 | #error use assym.h instead | | 73 | #error use assym.h instead |
74 | #endif | | 74 | #endif |
75 | | | 75 | |
76 | #if defined(_MODULE) | | 76 | #if defined(_MODULE) |
77 | #error this file should not be included by loadable kernel modules | | 77 | #error this file should not be included by loadable kernel modules |
78 | #endif | | 78 | #endif |
79 | | | 79 | |
80 | #include <powerpc/ibm4xx/tlb.h> | | 80 | #include <powerpc/ibm4xx/tlb.h> |
81 | | | 81 | |
82 | #define KERNEL_PID 1 /* TLB PID to use for kernel translation */ | | 82 | #define KERNEL_PID 1 /* TLB PID to use for kernel translation */ |
83 | | | 83 | |
84 | /* | | 84 | /* |
85 | * A TTE is a 16KB or greater TLB entry w/size and endianness bits | | 85 | * A TTE is a 16KB or greater TLB entry w/size and endianness bits |
| @@ -122,27 +122,27 @@ | | | @@ -122,27 +122,27 @@ |
122 | #define PTMAP (PTSZ * PAGE_SIZE) | | 122 | #define PTMAP (PTSZ * PAGE_SIZE) |
123 | #define PTMSK ((PTMAP - 1) & ~(PGOFSET)) | | 123 | #define PTMSK ((PTMAP - 1) & ~(PGOFSET)) |
124 | | | 124 | |
125 | #define PTIDX(v) (((v) & PTMSK) >> PGSHIFT) | | 125 | #define PTIDX(v) (((v) & PTMSK) >> PGSHIFT) |
126 | | | 126 | |
127 | /* 2nd level tables map in any bits not mapped by 1st level tables. */ | | 127 | /* 2nd level tables map in any bits not mapped by 1st level tables. */ |
128 | #define STSZ ((0xffffffffU / (PAGE_SIZE * PTSZ)) + 1) | | 128 | #define STSZ ((0xffffffffU / (PAGE_SIZE * PTSZ)) + 1) |
129 | #define STMAP (0xffffffffU) | | 129 | #define STMAP (0xffffffffU) |
130 | #define STMSK (~(PTMAP - 1)) | | 130 | #define STMSK (~(PTMAP - 1)) |
131 | | | 131 | |
132 | #define STIDX(v) ((v) >> (PGSHIFT + 12)) | | 132 | #define STIDX(v) ((v) >> (PGSHIFT + 12)) |
133 | | | 133 | |
134 | | | 134 | |
135 | /* | | 135 | /* |
136 | * Extra flags to pass to pmap_enter() -- make sure they don't conflict | | 136 | * Extra flags to pass to pmap_enter() -- make sure they don't conflict |
137 | * w/PMAP_CANFAIL or PMAP_WIRED | | 137 | * w/PMAP_CANFAIL or PMAP_WIRED |
138 | */ | | 138 | */ |
139 | #define PME_NOCACHE 0x1000000 | | 139 | #define PME_NOCACHE 0x1000000 |
140 | #define PME_WRITETHROUG 0x2000000 | | 140 | #define PME_WRITETHROUG 0x2000000 |
141 | | | 141 | |
142 | /* | | 142 | /* |
143 | * Pmap stuff | | 143 | * Pmap stuff |
144 | */ | | 144 | */ |
145 | struct pmap { | | 145 | struct pmap { |
146 | volatile int pm_ctx; /* PID to identify PMAP's entries in TLB */ | | 146 | volatile int pm_ctx; /* PID to identify PMAP's entries in TLB */ |
147 | int pm_refs; /* ref count */ | | 147 | int pm_refs; /* ref count */ |
148 | struct pmap_statistics pm_stats; /* pmap statistics */ | | 148 | struct pmap_statistics pm_stats; /* pmap statistics */ |