Merge branch 'upstream' of git://electric-eye.fr.zoreil.com/home/romieu/linux-2.6...
[linux-2.6] / 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 /*
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 /*
136  * This is defined here because IP27_SYMMON_STK_SIZE must be at least what
137  * we define here.  Since it's set up in the prom.  We can't redefine it later
138  * and expect more space to be allocated.  The way to find out the true size
139  * of the symmon stacks is to divide SYMMON_STK_SIZE by SYMMON_STK_STRIDE
140  * for a particular node.
141  */
142 #define SYMMON_STACK_SIZE               0x8000
143
144 #if defined (PROM)
145
146 /*
147  * These defines are prom version dependent.  No code other than the IP27
148  * prom should attempt to use these values.
149  */
150 #define IP27_LAUNCH_OFFSET              0x2400
151 #define IP27_LAUNCH_SIZE                0x400
152 #define IP27_LAUNCH_COUNT               2
153 #define IP27_LAUNCH_STRIDE              0x200
154
155 #define IP27_KLCONFIG_OFFSET            0x4000
156 #define IP27_KLCONFIG_SIZE              0xc000
157 #define IP27_KLCONFIG_COUNT             1
158 #define IP27_KLCONFIG_STRIDE            0
159
160 #define IP27_NMI_OFFSET                 0x3000
161 #define IP27_NMI_SIZE                   0x40
162 #define IP27_NMI_COUNT                  2
163 #define IP27_NMI_STRIDE                 0x40
164
165 #define IP27_PI_ERROR_OFFSET            0x12000
166 #define IP27_PI_ERROR_SIZE              0x4000
167 #define IP27_PI_ERROR_COUNT             1
168 #define IP27_PI_ERROR_STRIDE            0
169
170 #define IP27_SYMMON_STK_OFFSET          0x25000
171 #define IP27_SYMMON_STK_SIZE            0xe000
172 #define IP27_SYMMON_STK_COUNT           2
173 /* IP27_SYMMON_STK_STRIDE must be >= SYMMON_STACK_SIZE */
174 #define IP27_SYMMON_STK_STRIDE          0x7000
175
176 #define IP27_FREEMEM_OFFSET             0x19000
177 #define IP27_FREEMEM_SIZE               -1
178 #define IP27_FREEMEM_COUNT              1
179 #define IP27_FREEMEM_STRIDE             0
180
181 #endif /* PROM */
182 /*
183  * There will be only one of these in a partition so the IO6 must set it up.
184  */
185 #define IO6_GDA_OFFSET                  0x11000
186 #define IO6_GDA_SIZE                    0x400
187 #define IO6_GDA_COUNT                   1
188 #define IO6_GDA_STRIDE                  0
189
190 /*
191  * save area of kernel nmi regs in the prom format
192  */
193 #define IP27_NMI_KREGS_OFFSET           0x11400
194 #define IP27_NMI_KREGS_CPU_SIZE         0x200
195 /*
196  * save area of kernel nmi regs in eframe format
197  */
198 #define IP27_NMI_EFRAME_OFFSET          0x11800
199 #define IP27_NMI_EFRAME_SIZE            0x200
200
201 #define KLDIR_ENT_SIZE                  0x40
202 #define KLDIR_MAX_ENTRIES               (0x400 / 0x40)
203
204 #ifndef __ASSEMBLY__
205 typedef struct kldir_ent_s {
206         u64             magic;          /* Indicates validity of entry      */
207         off_t           offset;         /* Offset from start of node space  */
208         unsigned long   pointer;        /* Pointer to area in some cases    */
209         size_t          size;           /* Size in bytes                    */
210         u64             count;          /* Repeat count if array, 1 if not  */
211         size_t          stride;         /* Stride if array, 0 if not        */
212         char            rsvd[16];       /* Pad entry to 0x40 bytes          */
213         /* NOTE: These 16 bytes are used in the Partition KLDIR
214            entry to store partition info. Refer to klpart.h for this. */
215 } kldir_ent_t;
216 #endif /* !__ASSEMBLY__ */
217
218 #endif /* _ASM_SN_KLDIR_H */