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