lpardata.c 8.1 KB

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