ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-mips / sn / kldir.h
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Derived from IRIX <sys/SN/kldir.h>, revision 1.21.
7  *
8  * Copyright (C) 1992 - 1997, 1999, 2000 Silicon Graphics, Inc.
9  * Copyright (C) 1999, 2000 by Ralf Baechle
10  */
11 #ifndef _ASM_SN_KLDIR_H
12 #define _ASM_SN_KLDIR_H
13
14 #include <linux/config.h>
15
16 #if defined(CONFIG_SGI_IO)
17 #include <asm/hack.h>
18 #endif
19
20 /*
21  * The kldir memory area resides at a fixed place in each node's memory and
22  * provides pointers to most other IP27 memory areas.  This allows us to
23  * resize and/or relocate memory areas at a later time without breaking all
24  * firmware and kernels that use them.  Indices in the array are
25  * permanently dedicated to areas listed below.  Some memory areas (marked
26  * below) reside at a permanently fixed location, but are included in the
27  * directory for completeness.
28  */
29
30 #define KLDIR_MAGIC             0x434d5f53505f5357
31
32 /*
33  * The upper portion of the memory map applies during boot
34  * only and is overwritten by IRIX/SYMMON.
35  *
36  *                                    MEMORY MAP PER NODE
37  *
38  * 0x2000000 (32M)         +-----------------------------------------+
39  *                         |      IO6 BUFFERS FOR FLASH ENET IOC3    |
40  * 0x1F80000 (31.5M)       +-----------------------------------------+
41  *                         |      IO6 TEXT/DATA/BSS/stack            |
42  * 0x1C00000 (30M)         +-----------------------------------------+
43  *                         |      IO6 PROM DEBUG TEXT/DATA/BSS/stack |
44  * 0x0800000 (28M)         +-----------------------------------------+
45  *                         |      IP27 PROM TEXT/DATA/BSS/stack      |
46  * 0x1B00000 (27M)         +-----------------------------------------+
47  *                         |      IP27 CFG                           |
48  * 0x1A00000 (26M)         +-----------------------------------------+
49  *                         |      Graphics PROM                      |
50  * 0x1800000 (24M)         +-----------------------------------------+
51  *                         |      3rd Party PROM drivers             |
52  * 0x1600000 (22M)         +-----------------------------------------+
53  *                         |                                         |
54  *                         |      Free                               |
55  *                         |                                         |
56  *                         +-----------------------------------------+
57  *                         |      UNIX DEBUG Version                 |
58  * 0x190000 (2M--)         +-----------------------------------------+
59  *                         |      SYMMON                             |
60  *                         |      (For UNIX Debug only)              |
61  * 0x34000 (208K)          +-----------------------------------------+
62  *                         |      SYMMON STACK [NUM_CPU_PER_NODE]    |
63  *                         |      (For UNIX Debug only)              |
64  * 0x25000 (148K)          +-----------------------------------------+
65  *                         |      KLCONFIG - II (temp)               |
66  *                         |                                         |
67  *                         |    ----------------------------         |
68  *                         |                                         |
69  *                         |      UNIX NON-DEBUG Version             |
70  * 0x19000 (100K)          +-----------------------------------------+
71  *
72  *
73  * The lower portion of the memory map contains information that is
74  * permanent and is used by the IP27PROM, IO6PROM and IRIX.
75  *
76  * 0x19000 (100K)          +-----------------------------------------+
77  *                         |                                         |
78  *                         |      PI Error Spools (32K)              |
79  *                         |                                         |
80  * 0x12000 (72K)           +-----------------------------------------+
81  *                         |      Unused                             |
82  * 0x11c00 (71K)           +-----------------------------------------+
83  *                         |      CPU 1 NMI Eframe area              |
84  * 0x11a00 (70.5K)         +-----------------------------------------+
85  *                         |      CPU 0 NMI Eframe area              |
86  * 0x11800 (70K)           +-----------------------------------------+
87  *                         |      CPU 1 NMI Register save area       |
88  * 0x11600 (69.5K)         +-----------------------------------------+
89  *                         |      CPU 0 NMI Register save area       |
90  * 0x11400 (69K)           +-----------------------------------------+
91  *                         |      GDA (1k)                           |
92  * 0x11000 (68K)           +-----------------------------------------+
93  *                         |      Early cache Exception stack        |
94  *                         |             and/or                      |
95  *                         |      kernel/io6prom nmi registers       |
96  * 0x10800  (66k)          +-----------------------------------------+
97  *                         |      cache error eframe                 |
98  * 0x10400 (65K)           +-----------------------------------------+
99  *                         |      Exception Handlers (UALIAS copy)   |
100  * 0x10000 (64K)           +-----------------------------------------+
101  *                         |                                         |
102  *                         |                                         |
103  *                         |      KLCONFIG - I (permanent) (48K)     |
104  *                         |                                         |
105  *                         |                                         |
106  *                         |                                         |
107  * 0x4000 (16K)            +-----------------------------------------+
108  *                         |      NMI Handler (Protected Page)       |
109  * 0x3000 (12K)            +-----------------------------------------+
110  *                         |      ARCS PVECTORS (master node only)   |
111  * 0x2c00 (11K)            +-----------------------------------------+
112  *                         |      ARCS TVECTORS (master node only)   |
113  * 0x2800 (10K)            +-----------------------------------------+
114  *                         |      LAUNCH [NUM_CPU]                   |
115  * 0x2400 (9K)             +-----------------------------------------+
116  *                         |      Low memory directory (KLDIR)       |
117  * 0x2000 (8K)             +-----------------------------------------+
118  *                         |      ARCS SPB (1K)                      |
119  * 0x1000 (4K)             +-----------------------------------------+
120  *                         |      Early cache Exception stack        |
121  *                         |             and/or                      |
122  *                         |      kernel/io6prom nmi registers       |
123  * 0x800  (2k)             +-----------------------------------------+
124  *                         |      cache error eframe                 |
125  * 0x400 (1K)              +-----------------------------------------+
126  *                         |      Exception Handlers                 |
127  * 0x0   (0K)              +-----------------------------------------+
128  */
129
130 #ifdef __ASSEMBLY__
131 #define KLDIR_OFF_MAGIC                 0x00
132 #define KLDIR_OFF_OFFSET                0x08
133 #define KLDIR_OFF_POINTER               0x10
134 #define KLDIR_OFF_SIZE                  0x18
135 #define KLDIR_OFF_COUNT                 0x20
136 #define KLDIR_OFF_STRIDE                0x28
137 #endif /* __ASSEMBLY__ */
138
139 #if !defined(CONFIG_SGI_IO)
140
141 /*
142  * This is defined here because IP27_SYMMON_STK_SIZE must be at least what
143  * we define here.  Since it's set up in the prom.  We can't redefine it later
144  * and expect more space to be allocated.  The way to find out the true size
145  * of the symmon stacks is to divide SYMMON_STK_SIZE by SYMMON_STK_STRIDE
146  * for a particular node.
147  */
148 #define SYMMON_STACK_SIZE               0x8000
149
150 #if defined (PROM) || defined (SABLE)
151
152 /*
153  * These defines are prom version dependent.  No code other than the IP27
154  * prom should attempt to use these values.
155  */
156 #define IP27_LAUNCH_OFFSET              0x2400
157 #define IP27_LAUNCH_SIZE                0x400
158 #define IP27_LAUNCH_COUNT               2
159 #define IP27_LAUNCH_STRIDE              0x200
160
161 #define IP27_KLCONFIG_OFFSET            0x4000
162 #define IP27_KLCONFIG_SIZE              0xc000
163 #define IP27_KLCONFIG_COUNT             1
164 #define IP27_KLCONFIG_STRIDE            0
165
166 #define IP27_NMI_OFFSET                 0x3000
167 #define IP27_NMI_SIZE                   0x40
168 #define IP27_NMI_COUNT                  2
169 #define IP27_NMI_STRIDE                 0x40
170
171 #define IP27_PI_ERROR_OFFSET            0x12000
172 #define IP27_PI_ERROR_SIZE              0x4000
173 #define IP27_PI_ERROR_COUNT             1
174 #define IP27_PI_ERROR_STRIDE            0
175
176 #define IP27_SYMMON_STK_OFFSET          0x25000
177 #define IP27_SYMMON_STK_SIZE            0xe000
178 #define IP27_SYMMON_STK_COUNT           2
179 /* IP27_SYMMON_STK_STRIDE must be >= SYMMON_STACK_SIZE */
180 #define IP27_SYMMON_STK_STRIDE          0x7000
181
182 #define IP27_FREEMEM_OFFSET             0x19000
183 #define IP27_FREEMEM_SIZE               -1
184 #define IP27_FREEMEM_COUNT              1
185 #define IP27_FREEMEM_STRIDE             0
186
187 #endif /* PROM || SABLE*/
188 /*
189  * There will be only one of these in a partition so the IO6 must set it up.
190  */
191 #define IO6_GDA_OFFSET                  0x11000
192 #define IO6_GDA_SIZE                    0x400
193 #define IO6_GDA_COUNT                   1
194 #define IO6_GDA_STRIDE                  0
195
196 /*
197  * save area of kernel nmi regs in the prom format
198  */
199 #define IP27_NMI_KREGS_OFFSET           0x11400
200 #define IP27_NMI_KREGS_CPU_SIZE         0x200
201 /*
202  * save area of kernel nmi regs in eframe format
203  */
204 #define IP27_NMI_EFRAME_OFFSET          0x11800
205 #define IP27_NMI_EFRAME_SIZE            0x200
206
207 #define KLDIR_ENT_SIZE                  0x40
208 #define KLDIR_MAX_ENTRIES               (0x400 / 0x40)
209
210 #endif  /* !CONFIG_SGI_IO */
211
212 #ifndef __ASSEMBLY__
213 typedef struct kldir_ent_s {
214         u64             magic;          /* Indicates validity of entry      */
215         off_t           offset;         /* Offset from start of node space  */
216 #if defined(CONFIG_SGI_IO)      /* FIXME */
217         __psunsigned_t  pointer;        /* Pointer to area in some cases    */
218 #else
219         unsigned long   pointer;        /* Pointer to area in some cases    */
220 #endif
221         size_t          size;           /* Size in bytes                    */
222         u64             count;          /* Repeat count if array, 1 if not  */
223         size_t          stride;         /* Stride if array, 0 if not        */
224         char            rsvd[16];       /* Pad entry to 0x40 bytes          */
225         /* NOTE: These 16 bytes are used in the Partition KLDIR
226            entry to store partition info. Refer to klpart.h for this. */
227 } kldir_ent_t;
228 #endif /* !__ASSEMBLY__ */
229
230 #if defined(CONFIG_SGI_IO)
231
232 #define KLDIR_ENT_SIZE                  0x40
233 #define KLDIR_MAX_ENTRIES               (0x400 / 0x40)
234
235 /*
236  * The actual offsets of each memory area are machine-dependent
237  */
238 #ifdef CONFIG_SGI_IP27
239 // Not yet #include <asm/sn/sn0/kldir.h>
240 #elif defined(CONFIG_SGI_IP35)
241 #include <asm/sn/sn1/kldir.h>
242 #else
243 #error "kldir.h is currently defined for IP27 and IP35 platforms only"
244 #endif
245
246 #endif  /* CONFIG_SGI_IO */
247
248 #endif /* _ASM_SN_KLDIR_H */