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,2001-2003 Silicon Graphics, Inc.  All Rights Reserved.
9  * Copyright (C) 1999 by Ralf Baechle
10  */
11 #ifndef _ASM_IA64_SN_KLDIR_H
12 #define _ASM_IA64_SN_KLDIR_H
13 
14 #include <asm/sn/sgi.h>
15 
16 /*
17  * The kldir memory area resides at a fixed place in each node's memory and
18  * provides pointers to most other IP27 memory areas.  This allows us to
19  * resize and/or relocate memory areas at a later time without breaking all
20  * firmware and kernels that use them.  Indices in the array are
21  * permanently dedicated to areas listed below.  Some memory areas (marked
22  * below) reside at a permanently fixed location, but are included in the
23  * directory for completeness.
24  */
25 
26 #define KLDIR_MAGIC		0x434d5f53505f5357
27 
28 /*
29  * The upper portion of the memory map applies during boot
30  * only and is overwritten by IRIX/SYMMON.
31  *
32  *                                    MEMORY MAP PER NODE
33  *
34  * 0x2000000 (32M)         +-----------------------------------------+
35  *                         |      IO6 BUFFERS FOR FLASH ENET IOC3    |
36  * 0x1F80000 (31.5M)       +-----------------------------------------+
37  *                         |      IO6 TEXT/DATA/BSS/stack            |
38  * 0x1C00000 (30M)         +-----------------------------------------+
39  *                         |      IO6 PROM DEBUG TEXT/DATA/BSS/stack |
40  * 0x0800000 (28M)         +-----------------------------------------+
41  *                         |      IP27 PROM TEXT/DATA/BSS/stack      |
42  * 0x1B00000 (27M)         +-----------------------------------------+
43  *                         |      IP27 CFG                           |
44  * 0x1A00000 (26M)         +-----------------------------------------+
45  *                         |      Graphics PROM                      |
46  * 0x1800000 (24M)         +-----------------------------------------+
47  *                         |      3rd Party PROM drivers             |
48  * 0x1600000 (22M)         +-----------------------------------------+
49  *                         |                                         |
50  *                         |      Free                               |
51  *                         |                                         |
52  *                         +-----------------------------------------+
53  *                         |      UNIX DEBUG Version                 |
54  * 0x190000 (2M--)         +-----------------------------------------+
55  *                         |      SYMMON                             |
56  *                         |      (For UNIX Debug only)              |
57  * 0x34000 (208K)          +-----------------------------------------+
58  *                         |      SYMMON STACK [NUM_CPU_PER_NODE]    |
59  *                         |      (For UNIX Debug only)              |
60  * 0x25000 (148K)          +-----------------------------------------+
61  *                         |      KLCONFIG - II (temp)               |
62  *                         |                                         |
63  *                         |    ----------------------------         |
64  *                         |                                         |
65  *                         |      UNIX NON-DEBUG Version             |
66  * 0x19000 (100K)          +-----------------------------------------+
67  *
68  *
69  * The lower portion of the memory map contains information that is
70  * permanent and is used by the IP27PROM, IO6PROM and IRIX.
71  *
72  * 0x19000 (100K)          +-----------------------------------------+
73  *                         |                                         |
74  *                         |      PI Error Spools (32K)              |
75  *                         |                                         |
76  * 0x12000 (72K)           +-----------------------------------------+
77  *                         |      Unused                             |
78  * 0x11c00 (71K)           +-----------------------------------------+
79  *                         |      CPU 1 NMI Eframe area       	     |
80  * 0x11a00 (70.5K)         +-----------------------------------------+
81  *                         |      CPU 0 NMI Eframe area       	     |
82  * 0x11800 (70K)           +-----------------------------------------+
83  *                         |      CPU 1 NMI Register save area       |
84  * 0x11600 (69.5K)         +-----------------------------------------+
85  *                         |      CPU 0 NMI Register save area       |
86  * 0x11400 (69K)           +-----------------------------------------+
87  *                         |      GDA (1k)                           |
88  * 0x11000 (68K)           +-----------------------------------------+
89  *                         |      Early cache Exception stack        |
90  *                         |             and/or                      |
91  *			   |      kernel/io6prom nmi registers	     |
92  * 0x10800  (66k)	   +-----------------------------------------+
93  *			   |      cache error eframe   	 	     |
94  * 0x10400 (65K)           +-----------------------------------------+
95  *                         |      Exception Handlers (UALIAS copy)   |
96  * 0x10000 (64K)           +-----------------------------------------+
97  *                         |                                         |
98  *                         |                                         |
99  *                         |      KLCONFIG - I (permanent) (48K)     |
100  *                         |                                         |
101  *                         |                                         |
102  *                         |                                         |
103  * 0x4000 (16K)            +-----------------------------------------+
104  *                         |      NMI Handler (Protected Page)       |
105  * 0x3000 (12K)            +-----------------------------------------+
106  *                         |      ARCS PVECTORS (master node only)   |
107  * 0x2c00 (11K)            +-----------------------------------------+
108  *                         |      ARCS TVECTORS (master node only)   |
109  * 0x2800 (10K)            +-----------------------------------------+
110  *                         |      LAUNCH [NUM_CPU]                   |
111  * 0x2400 (9K)             +-----------------------------------------+
112  *                         |      Low memory directory (KLDIR)       |
113  * 0x2000 (8K)             +-----------------------------------------+
114  *                         |      ARCS SPB (1K)                      |
115  * 0x1000 (4K)             +-----------------------------------------+
116  *                         |      Early cache Exception stack        |
117  *                         |             and/or                      |
118  *			   |      kernel/io6prom nmi registers	     |
119  * 0x800  (2k)	           +-----------------------------------------+
120  *			   |      cache error eframe   	 	     |
121  * 0x400 (1K)              +-----------------------------------------+
122  *                         |      Exception Handlers                 |
123  * 0x0   (0K)              +-----------------------------------------+
124  */
125 
126 #ifdef __ASSEMBLY__
127 #define KLDIR_OFF_MAGIC			0x00
128 #define KLDIR_OFF_OFFSET		0x08
129 #define KLDIR_OFF_POINTER		0x10
130 #define KLDIR_OFF_SIZE			0x18
131 #define KLDIR_OFF_COUNT			0x20
132 #define KLDIR_OFF_STRIDE		0x28
133 #endif /* __ASSEMBLY__ */
134 
135 #ifndef __ASSEMBLY__
136 typedef struct kldir_ent_s {
137 	u64		magic;		/* Indicates validity of entry      */
138 	off_t		offset;		/* Offset from start of node space  */
139 	__psunsigned_t	pointer;	/* Pointer to area in some cases    */
140 	size_t		size;		/* Size in bytes 		    */
141 	u64		count;		/* Repeat count if array, 1 if not  */
142 	size_t		stride;		/* Stride if array, 0 if not        */
143 	char		rsvd[16];	/* Pad entry to 0x40 bytes          */
144 	/* NOTE: These 16 bytes are used in the Partition KLDIR
145 	   entry to store partition info. Refer to klpart.h for this. */
146 } kldir_ent_t;
147 #endif /* __ASSEMBLY__ */
148 
149 
150 #define KLDIR_ENT_SIZE			0x40
151 #define KLDIR_MAX_ENTRIES		(0x400 / 0x40)
152 
153 
154 
155 /*
156  * The upper portion of the memory map applies during boot
157  * only and is overwritten by IRIX/SYMMON.  The minimum memory bank
158  * size on IP35 is 64M, which provides a limit on the amount of space
159  * the PROM can assume it has available.
160  *
161  * Most of the addresses below are defined as macros in this file, or
162  * in SN/addrs.h or SN/SN1/addrs.h.
163  *
164  *                                    MEMORY MAP PER NODE
165  *
166  * 0x4000000 (64M)         +-----------------------------------------+
167  *                         |                                         |
168  *                         |                                         |
169  *                         |      IO7 TEXT/DATA/BSS/stack            |
170  * 0x3000000 (48M)         +-----------------------------------------+
171  *                         |      Free                               |
172  * 0x2102000 (>33M)        +-----------------------------------------+
173  *                         |      IP35 Topology (PCFG) + misc data   |
174  * 0x2000000 (32M)         +-----------------------------------------+
175  *                         |      IO7 BUFFERS FOR FLASH ENET IOC3    |
176  * 0x1F80000 (31.5M)       +-----------------------------------------+
177  *                         |      Free                               |
178  * 0x1C00000 (28M)         +-----------------------------------------+
179  *                         |      IP35 PROM TEXT/DATA/BSS/stack      |
180  * 0x1A00000 (26M)         +-----------------------------------------+
181  *                         |      Routing temp. space                |
182  * 0x1800000 (24M)         +-----------------------------------------+
183  *                         |      Diagnostics temp. space            |
184  * 0x1500000 (21M)         +-----------------------------------------+
185  *                         |      Free                               |
186  * 0x1400000 (20M)         +-----------------------------------------+
187  *                         |      IO7 PROM temporary copy            |
188  * 0x1300000 (19M)         +-----------------------------------------+
189  *                         |                                         |
190  *                         |      Free                               |
191  *                         |      (UNIX DATA starts above 0x1000000) |
192  *                         |                                         |
193  *                         +-----------------------------------------+
194  *                         |      UNIX DEBUG Version                 |
195  * 0x0310000 (3.1M)        +-----------------------------------------+
196  *                         |      SYMMON, loaded just below UNIX     |
197  *                         |      (For UNIX Debug only)              |
198  *                         |                                         |
199  *                         |                                         |
200  * 0x006C000 (432K)        +-----------------------------------------+
201  *                         |      SYMMON STACK [NUM_CPU_PER_NODE]    |
202  *                         |      (For UNIX Debug only)              |
203  * 0x004C000 (304K)        +-----------------------------------------+
204  *                         |                                         |
205  *                         |                                         |
206  *                         |      UNIX NON-DEBUG Version             |
207  * 0x0040000 (256K)        +-----------------------------------------+
208  *
209  *
210  * The lower portion of the memory map contains information that is
211  * permanent and is used by the IP35PROM, IO7PROM and IRIX.
212  *
213  * 0x40000 (256K)          +-----------------------------------------+
214  *                         |                                         |
215  *                         |      KLCONFIG (64K)                     |
216  *                         |                                         |
217  * 0x30000 (192K)          +-----------------------------------------+
218  *                         |                                         |
219  *                         |      PI Error Spools (64K)              |
220  *                         |                                         |
221  * 0x20000 (128K)          +-----------------------------------------+
222  *                         |                                         |
223  *                         |      Unused                             |
224  *                         |                                         |
225  * 0x19000 (100K)          +-----------------------------------------+
226  *                         |      Early cache Exception stack (CPU 3)|
227  * 0x18800 (98K)           +-----------------------------------------+
228  *			   |      cache error eframe (CPU 3)	     |
229  * 0x18400 (97K)           +-----------------------------------------+
230  *                         |      Exception Handlers (CPU 3)         |
231  * 0x18000 (96K)           +-----------------------------------------+
232  *                         |                                         |
233  *                         |      Unused                             |
234  *                         |                                         |
235  * 0x13c00 (79K)           +-----------------------------------------+
236  *                         |      GPDA (8k)                          |
237  * 0x11c00 (71K)           +-----------------------------------------+
238  *                         |      Early cache Exception stack (CPU 2)|
239  * 0x10800 (66k)	   +-----------------------------------------+
240  *			   |      cache error eframe (CPU 2)	     |
241  * 0x10400 (65K)           +-----------------------------------------+
242  *                         |      Exception Handlers (CPU 2)         |
243  * 0x10000 (64K)           +-----------------------------------------+
244  *                         |                                         |
245  *                         |      Unused                             |
246  *                         |                                         |
247  * 0x0b400 (45K)           +-----------------------------------------+
248  *                         |      GDA (1k)                           |
249  * 0x0b000 (44K)           +-----------------------------------------+
250  *                         |      NMI Eframe areas (4)       	     |
251  * 0x0a000 (40K)           +-----------------------------------------+
252  *                         |      NMI Register save areas (4)        |
253  * 0x09000 (36K)           +-----------------------------------------+
254  *                         |      Early cache Exception stack (CPU 1)|
255  * 0x08800 (34K)           +-----------------------------------------+
256  *			   |      cache error eframe (CPU 1)	     |
257  * 0x08400 (33K)           +-----------------------------------------+
258  *                         |      Exception Handlers (CPU 1)         |
259  * 0x08000 (32K)           +-----------------------------------------+
260  *                         |                                         |
261  *                         |                                         |
262  *                         |      Unused                             |
263  *                         |                                         |
264  *                         |                                         |
265  * 0x04000 (16K)           +-----------------------------------------+
266  *                         |      NMI Handler (Protected Page)       |
267  * 0x03000 (12K)           +-----------------------------------------+
268  *                         |      ARCS PVECTORS (master node only)   |
269  * 0x02c00 (11K)           +-----------------------------------------+
270  *                         |      ARCS TVECTORS (master node only)   |
271  * 0x02800 (10K)           +-----------------------------------------+
272  *                         |      LAUNCH [NUM_CPU]                   |
273  * 0x02400 (9K)            +-----------------------------------------+
274  *                         |      Low memory directory (KLDIR)       |
275  * 0x02000 (8K)            +-----------------------------------------+
276  *                         |      ARCS SPB (1K)                      |
277  * 0x01000 (4K)            +-----------------------------------------+
278  *                         |      Early cache Exception stack (CPU 0)|
279  * 0x00800 (2k)	           +-----------------------------------------+
280  *			   |      cache error eframe (CPU 0)	     |
281  * 0x00400 (1K)            +-----------------------------------------+
282  *                         |      Exception Handlers (CPU 0)         |
283  * 0x00000 (0K)            +-----------------------------------------+
284  */
285 
286 /*
287  * NOTE:  To change the kernel load address, you must update:
288  *  - the appropriate elspec files in irix/kern/master.d
289  *  - NODEBUGUNIX_ADDR in SN/SN1/addrs.h
290  *  - IP27_FREEMEM_OFFSET below
291  *  - KERNEL_START_OFFSET below (if supporting cells)
292  */
293 
294 
295 /*
296  * This is defined here because IP27_SYMMON_STK_SIZE must be at least what
297  * we define here.  Since it's set up in the prom.  We can't redefine it later
298  * and expect more space to be allocated.  The way to find out the true size
299  * of the symmon stacks is to divide SYMMON_STK_SIZE by SYMMON_STK_STRIDE
300  * for a particular node.
301  */
302 #define SYMMON_STACK_SIZE		0x8000
303 
304 #if defined (PROM) || defined (SABLE)
305 
306 /*
307  * These defines are prom version dependent.  No code other than the IP35
308  * prom should attempt to use these values.
309  */
310 #define IP27_LAUNCH_OFFSET		0x2400
311 #define IP27_LAUNCH_SIZE		0x400
312 #define IP27_LAUNCH_COUNT		4
313 #define IP27_LAUNCH_STRIDE		0x100 /* could be as small as 0x80 */
314 
315 #define IP27_KLCONFIG_OFFSET		0x30000
316 #define IP27_KLCONFIG_SIZE		0x10000
317 #define IP27_KLCONFIG_COUNT		1
318 #define IP27_KLCONFIG_STRIDE		0
319 
320 #define IP27_NMI_OFFSET			0x3000
321 #define IP27_NMI_SIZE			0x100
322 #define IP27_NMI_COUNT			4
323 #define IP27_NMI_STRIDE			0x40
324 
325 #define IP27_PI_ERROR_OFFSET		0x20000
326 #define IP27_PI_ERROR_SIZE		0x10000
327 #define IP27_PI_ERROR_COUNT		1
328 #define IP27_PI_ERROR_STRIDE		0
329 
330 #define IP27_SYMMON_STK_OFFSET		0x4c000
331 #define IP27_SYMMON_STK_SIZE		0x20000
332 #define IP27_SYMMON_STK_COUNT		4
333 /* IP27_SYMMON_STK_STRIDE must be >= SYMMON_STACK_SIZE */
334 #define IP27_SYMMON_STK_STRIDE		0x8000
335 
336 #define IP27_FREEMEM_OFFSET		0x40000
337 #define IP27_FREEMEM_SIZE		(-1)
338 #define IP27_FREEMEM_COUNT		1
339 #define IP27_FREEMEM_STRIDE		0
340 
341 #endif /* PROM || SABLE*/
342 /*
343  * There will be only one of these in a partition so the IO7 must set it up.
344  */
345 #define IO6_GDA_OFFSET			0xb000
346 #define IO6_GDA_SIZE			0x400
347 #define IO6_GDA_COUNT			1
348 #define IO6_GDA_STRIDE			0
349 
350 /*
351  * save area of kernel nmi regs in the prom format
352  */
353 #define IP27_NMI_KREGS_OFFSET		0x9000
354 #define IP27_NMI_KREGS_CPU_SIZE		0x400
355 /*
356  * save area of kernel nmi regs in eframe format
357  */
358 #define IP27_NMI_EFRAME_OFFSET		0xa000
359 #define IP27_NMI_EFRAME_SIZE		0x400
360 
361 #define GPDA_OFFSET			0x11c00
362 
363 #endif /* _ASM_IA64_SN_KLDIR_H */
364