lpardata.c 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /*
  2. * Copyright 2001 Mike Corrigan, IBM Corp
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #include <linux/config.h>
  10. #include <linux/types.h>
  11. #include <linux/threads.h>
  12. #include <linux/module.h>
  13. #include <linux/bitops.h>
  14. #include <asm/processor.h>
  15. #include <asm/ptrace.h>
  16. #include <asm/abs_addr.h>
  17. #include <asm/iseries/it_lp_naca.h>
  18. #include <asm/lppaca.h>
  19. #include <asm/iseries/it_lp_reg_save.h>
  20. #include <asm/paca.h>
  21. #include <asm/iseries/lpar_map.h>
  22. #include <asm/iseries/it_exp_vpd_panel.h>
  23. #include <asm/iseries/it_lp_queue.h>
  24. #include "naca.h"
  25. #include "vpd_areas.h"
  26. #include "spcomm_area.h"
  27. #include "ipl_parms.h"
  28. #include "processor_vpd.h"
  29. #include "release_data.h"
  30. /* The HvReleaseData is the root of the information shared between
  31. * the hypervisor and Linux.
  32. */
  33. struct HvReleaseData hvReleaseData = {
  34. .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */
  35. .xSize = sizeof(struct HvReleaseData),
  36. .xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas),
  37. .xSlicNacaAddr = &naca, /* 64-bit Naca address */
  38. .xMsNucDataOffset = LPARMAP_PHYS,
  39. .xFlags = HVREL_TAGSINACTIVE /* tags inactive */
  40. /* 64 bit */
  41. /* shared processors */
  42. /* HMT allowed */
  43. | 6, /* TEMP: This allows non-GA driver */
  44. .xVrmIndex = 4, /* We are v5r2m0 */
  45. .xMinSupportedPlicVrmIndex = 3, /* v5r1m0 */
  46. .xMinCompatablePlicVrmIndex = 3, /* v5r1m0 */
  47. .xVrmName = { 0xd3, 0x89, 0x95, 0xa4, /* "Linux 2.4.64" ebcdic */
  48. 0xa7, 0x40, 0xf2, 0x4b,
  49. 0xf4, 0x4b, 0xf6, 0xf4 },
  50. };
  51. /*
  52. * The NACA. The first dword of the naca is required by the iSeries
  53. * hypervisor to point to itVpdAreas. The hypervisor finds the NACA
  54. * through the pointer in hvReleaseData.
  55. */
  56. struct naca_struct naca = {
  57. .xItVpdAreas = &itVpdAreas,
  58. .xRamDisk = 0,
  59. .xRamDiskSize = 0,
  60. };
  61. extern void system_reset_iSeries(void);
  62. extern void machine_check_iSeries(void);
  63. extern void data_access_iSeries(void);
  64. extern void instruction_access_iSeries(void);
  65. extern void hardware_interrupt_iSeries(void);
  66. extern void alignment_iSeries(void);
  67. extern void program_check_iSeries(void);
  68. extern void fp_unavailable_iSeries(void);
  69. extern void decrementer_iSeries(void);
  70. extern void trap_0a_iSeries(void);
  71. extern void trap_0b_iSeries(void);
  72. extern void system_call_iSeries(void);
  73. extern void single_step_iSeries(void);
  74. extern void trap_0e_iSeries(void);
  75. extern void performance_monitor_iSeries(void);
  76. extern void data_access_slb_iSeries(void);
  77. extern void instruction_access_slb_iSeries(void);
  78. struct ItLpNaca itLpNaca = {
  79. .xDesc = 0xd397d581, /* "LpNa" ebcdic */
  80. .xSize = 0x0400, /* size of ItLpNaca */
  81. .xIntHdlrOffset = 0x0300, /* offset to int array */
  82. .xMaxIntHdlrEntries = 19, /* # ents */
  83. .xPrimaryLpIndex = 0, /* Part # of primary */
  84. .xServiceLpIndex = 0, /* Part # of serv */
  85. .xLpIndex = 0, /* Part # of me */
  86. .xMaxLpQueues = 0, /* # of LP queues */
  87. .xLpQueueOffset = 0x100, /* offset of start of LP queues */
  88. .xPirEnvironMode = 0, /* Piranha stuff */
  89. .xPirConsoleMode = 0,
  90. .xPirDasdMode = 0,
  91. .flags = 0,
  92. .xSpVpdFormat = 0,
  93. .xIntProcRatio = 0,
  94. .xPlicVrmIndex = 0, /* VRM index of PLIC */
  95. .xMinSupportedSlicVrmInd = 0, /* min supported SLIC */
  96. .xMinCompatableSlicVrmInd = 0, /* min compat SLIC */
  97. .xLoadAreaAddr = 0, /* 64-bit addr of load area */
  98. .xLoadAreaChunks = 0, /* chunks for load area */
  99. .xPaseSysCallCRMask = 0, /* PASE mask */
  100. .xSlicSegmentTablePtr = 0, /* seg table */
  101. .xOldLpQueue = { 0 }, /* Old LP Queue */
  102. .xInterruptHdlr = {
  103. (u64)system_reset_iSeries, /* 0x100 System Reset */
  104. (u64)machine_check_iSeries, /* 0x200 Machine Check */
  105. (u64)data_access_iSeries, /* 0x300 Data Access */
  106. (u64)instruction_access_iSeries, /* 0x400 Instruction Access */
  107. (u64)hardware_interrupt_iSeries, /* 0x500 External */
  108. (u64)alignment_iSeries, /* 0x600 Alignment */
  109. (u64)program_check_iSeries, /* 0x700 Program Check */
  110. (u64)fp_unavailable_iSeries, /* 0x800 FP Unavailable */
  111. (u64)decrementer_iSeries, /* 0x900 Decrementer */
  112. (u64)trap_0a_iSeries, /* 0xa00 Trap 0A */
  113. (u64)trap_0b_iSeries, /* 0xb00 Trap 0B */
  114. (u64)system_call_iSeries, /* 0xc00 System Call */
  115. (u64)single_step_iSeries, /* 0xd00 Single Step */
  116. (u64)trap_0e_iSeries, /* 0xe00 Trap 0E */
  117. (u64)performance_monitor_iSeries,/* 0xf00 Performance Monitor */
  118. 0, /* int 0x1000 */
  119. 0, /* int 0x1010 */
  120. 0, /* int 0x1020 CPU ctls */
  121. (u64)hardware_interrupt_iSeries, /* SC Ret Hdlr */
  122. (u64)data_access_slb_iSeries, /* 0x380 D-SLB */
  123. (u64)instruction_access_slb_iSeries /* 0x480 I-SLB */
  124. }
  125. };
  126. EXPORT_SYMBOL(itLpNaca);
  127. /* May be filled in by the hypervisor so cannot end up in the BSS */
  128. struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data")));
  129. /* May be filled in by the hypervisor so cannot end up in the BSS */
  130. struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data")));
  131. EXPORT_SYMBOL(xItExtVpdPanel);
  132. #define maxPhysicalProcessors 32
  133. struct IoHriProcessorVpd xIoHriProcessorVpd[maxPhysicalProcessors] = {
  134. {
  135. .xInstCacheOperandSize = 32,
  136. .xDataCacheOperandSize = 32,
  137. .xProcFreq = 50000000,
  138. .xTimeBaseFreq = 50000000,
  139. .xPVR = 0x3600
  140. }
  141. };
  142. /* Space for Main Store Vpd 27,200 bytes */
  143. /* May be filled in by the hypervisor so cannot end up in the BSS */
  144. u64 xMsVpd[3400] __attribute__((__section__(".data")));
  145. /* Space for Recovery Log Buffer */
  146. /* May be filled in by the hypervisor so cannot end up in the BSS */
  147. u64 xRecoveryLogBuffer[32] __attribute__((__section__(".data")));
  148. struct SpCommArea xSpCommArea = {
  149. .xDesc = 0xE2D7C3C2,
  150. .xFormat = 1,
  151. };
  152. /* The LparMap data is now located at offset 0x6000 in head.S
  153. * It was put there so that the HvReleaseData could address it
  154. * with a 32-bit offset as required by the iSeries hypervisor
  155. *
  156. * The Naca has a pointer to the ItVpdAreas. The hypervisor finds
  157. * the Naca via the HvReleaseData area. The HvReleaseData has the
  158. * offset into the Naca of the pointer to the ItVpdAreas.
  159. */
  160. struct ItVpdAreas itVpdAreas = {
  161. .xSlicDesc = 0xc9a3e5c1, /* "ItVA" */
  162. .xSlicSize = sizeof(struct ItVpdAreas),
  163. .xSlicVpdEntries = ItVpdMaxEntries, /* # VPD array entries */
  164. .xSlicDmaEntries = ItDmaMaxEntries, /* # DMA array entries */
  165. .xSlicMaxLogicalProcs = NR_CPUS * 2, /* Max logical procs */
  166. .xSlicMaxPhysicalProcs = maxPhysicalProcessors, /* Max physical procs */
  167. .xSlicDmaToksOffset = offsetof(struct ItVpdAreas, xPlicDmaToks),
  168. .xSlicVpdAdrsOffset = offsetof(struct ItVpdAreas, xSlicVpdAdrs),
  169. .xSlicDmaLensOffset = offsetof(struct ItVpdAreas, xPlicDmaLens),
  170. .xSlicVpdLensOffset = offsetof(struct ItVpdAreas, xSlicVpdLens),
  171. .xSlicMaxSlotLabels = 0, /* max slot labels */
  172. .xSlicMaxLpQueues = 1, /* max LP queues */
  173. .xPlicDmaLens = { 0 }, /* DMA lengths */
  174. .xPlicDmaToks = { 0 }, /* DMA tokens */
  175. .xSlicVpdLens = { /* VPD lengths */
  176. 0,0,0, /* 0 - 2 */
  177. sizeof(xItExtVpdPanel), /* 3 Extended VPD */
  178. sizeof(struct paca_struct), /* 4 length of Paca */
  179. 0, /* 5 */
  180. sizeof(struct ItIplParmsReal),/* 6 length of IPL parms */
  181. 26992, /* 7 length of MS VPD */
  182. 0, /* 8 */
  183. sizeof(struct ItLpNaca),/* 9 length of LP Naca */
  184. 0, /* 10 */
  185. 256, /* 11 length of Recovery Log Buf */
  186. sizeof(struct SpCommArea), /* 12 length of SP Comm Area */
  187. 0,0,0, /* 13 - 15 */
  188. sizeof(struct IoHriProcessorVpd),/* 16 length of Proc Vpd */
  189. 0,0,0,0,0,0, /* 17 - 22 */
  190. sizeof(struct hvlpevent_queue), /* 23 length of Lp Queue */
  191. 0,0 /* 24 - 25 */
  192. },
  193. .xSlicVpdAdrs = { /* VPD addresses */
  194. 0,0,0, /* 0 - 2 */
  195. &xItExtVpdPanel, /* 3 Extended VPD */
  196. &paca[0], /* 4 first Paca */
  197. 0, /* 5 */
  198. &xItIplParmsReal, /* 6 IPL parms */
  199. &xMsVpd, /* 7 MS Vpd */
  200. 0, /* 8 */
  201. &itLpNaca, /* 9 LpNaca */
  202. 0, /* 10 */
  203. &xRecoveryLogBuffer, /* 11 Recovery Log Buffer */
  204. &xSpCommArea, /* 12 SP Comm Area */
  205. 0,0,0, /* 13 - 15 */
  206. &xIoHriProcessorVpd, /* 16 Proc Vpd */
  207. 0,0,0,0,0,0, /* 17 - 22 */
  208. &hvlpevent_queue, /* 23 Lp Queue */
  209. 0,0
  210. }
  211. };
  212. struct ItLpRegSave iseries_reg_save[] = {
  213. [0 ... (NR_CPUS-1)] = {
  214. .xDesc = 0xd397d9e2, /* "LpRS" */
  215. .xSize = sizeof(struct ItLpRegSave),
  216. },
  217. };