kldir.h 10 KB

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