Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * Hypervisor Software File: strand.h | |
5 | * | |
6 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
7 | * | |
8 | * - Do no alter or remove copyright notices | |
9 | * | |
10 | * - Redistribution and use of this software in source and binary forms, with | |
11 | * or without modification, are permitted provided that the following | |
12 | * conditions are met: | |
13 | * | |
14 | * - Redistribution of source code must retain the above copyright notice, | |
15 | * this list of conditions and the following disclaimer. | |
16 | * | |
17 | * - Redistribution in binary form must reproduce the above copyright notice, | |
18 | * this list of conditions and the following disclaimer in the | |
19 | * documentation and/or other materials provided with the distribution. | |
20 | * | |
21 | * Neither the name of Sun Microsystems, Inc. or the names of contributors | |
22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | |
24 | * | |
25 | * This software is provided "AS IS," without a warranty of any kind. | |
26 | * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, | |
27 | * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A | |
28 | * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN | |
29 | * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR | |
30 | * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR | |
31 | * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN | |
32 | * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR | |
33 | * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE | |
34 | * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, | |
35 | * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF | |
36 | * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
37 | * | |
38 | * You acknowledge that this software is not designed, licensed or | |
39 | * intended for use in the design, construction, operation or maintenance of | |
40 | * any nuclear facility. | |
41 | * | |
42 | * ========== Copyright Header End ============================================ | |
43 | */ | |
44 | /* | |
45 | * Copyright 2007 Sun Microsystems, Inc. All rights reserved. | |
46 | * Use is subject to license terms. | |
47 | */ | |
48 | ||
49 | #ifndef _PLATFORM_STRAND_H | |
50 | #define _PLATFORM_STRAND_H | |
51 | ||
52 | #pragma ident "@(#)strand.h 1.22 07/05/03 SMI" | |
53 | ||
54 | #include <sun4v/errs_defs.h> | |
55 | #include <cpu_errs_defs.h> | |
56 | ||
57 | #ifdef __cplusplus | |
58 | extern "C" { | |
59 | #endif | |
60 | ||
61 | #include <sun4v/errs_defs.h> | |
62 | #include <cpu_errs.h> | |
63 | #include <cpu_errs_defs.h> | |
64 | ||
65 | #ifndef _ASM | |
66 | /* | |
67 | * Structures for saving watchdog failure state | |
68 | */ | |
69 | struct trapstate { | |
70 | uint64_t htstate; | |
71 | uint64_t tstate; | |
72 | uint64_t tt; | |
73 | uint64_t tpc; | |
74 | uint64_t tnpc; | |
75 | }; | |
76 | ||
77 | struct trapglobals { | |
78 | uint64_t g[8]; | |
79 | }; | |
80 | ||
81 | #if NSTRANDS > 256 | |
82 | error The strand id field is encoded in an 8bit value | |
83 | error for more than 256 strands this needs to have its type changed | |
84 | #endif | |
85 | ||
86 | struct strand { | |
87 | uint8_t id; /* physical strand number */ | |
88 | struct config *configp; | |
89 | ||
90 | /* | |
91 | * This list is used to assign work to this strand. | |
92 | * The current_slot points to the slot action in progress | |
93 | * We only allow the local strand to manipulate its slots | |
94 | * which means (along as interrupts are off) we've no need | |
95 | * for locks around this structure. | |
96 | */ | |
97 | uint16_t current_slot; | |
98 | struct sched_slot slot[NUM_SCHED_SLOTS]; | |
99 | ||
100 | /* | |
101 | * This is the HV strand X-Call mailbox. | |
102 | * This should evolve into an LDC channel with endpoints between | |
103 | * each of the strands (a N*N matrix) and a mondo queue indicating | |
104 | * which incomming endpoints need servicing, but that happens when | |
105 | * we assign guest0 as the HV's context - later. | |
106 | */ | |
107 | struct xcall_mbox xc_mb; | |
108 | uint64_t hv_txmondo[8]; | |
109 | uint64_t hv_rxmondo[8]; | |
110 | ||
111 | /* | |
112 | * Initialisation support .. FIXME .. we could use scratch | |
113 | * values instead as these are only used at the beginning of time | |
114 | */ | |
115 | uint64_t scrub_basepa; | |
116 | uint64_t scrub_size; | |
117 | ||
118 | /* | |
119 | * The mini-stack used for the PUSH & POP macros. | |
120 | */ | |
121 | struct mini_stack mini_stack; | |
122 | ||
123 | uint64_t scr[NSTRANDSCRATCH]; /* scratch space */ | |
124 | ||
125 | /* | |
126 | * hstick interrupt support | |
127 | */ | |
128 | struct cyclic cyclic; | |
129 | ||
130 | /* | |
131 | * Error handling support | |
132 | */ | |
133 | ||
134 | /* | |
135 | * support for when we get a UE with TSTATE.GL == GL | |
136 | */ | |
137 | uint64_t ue_tmp1; | |
138 | uint64_t ue_tmp2; | |
139 | struct trapglobals ue_globals[MAXTL]; | |
140 | uint64_t err_seq_no; /* unique sequence # */ | |
141 | uint64_t regerr; /* SPARC ESR for IRC/FRC */ | |
142 | int16_t l2_bank; /* l2 bank */ | |
143 | int16_t rpt_flags; /* Report flags: action, buf */ | |
144 | int16_t wip; /* flag: Work In Progress */ | |
145 | uint32_t err_flag; /* error handling flags */ | |
146 | uint64_t err_poll_tick; /* poll time in ticks */ | |
147 | uint64_t err_ret; /* saved return address */ | |
148 | uint64_t err_poll_itt; /* saved interrupt tick time */ | |
149 | uint64_t err_poll_ret; /* saved return address */ | |
150 | uint64_t err_sparc_afsr; /* tmp store */ | |
151 | uint64_t err_sparc_afar; /* tmp store */ | |
152 | uint64_t l2_line_state; /* state of line on err */ | |
153 | struct strand_erpt ce_rpt; /* CE error buffer */ | |
154 | struct strand_erpt ue_rpt; /* UE error buffer */ | |
155 | uint64_t io_prot; /* i/o error protection flag */ | |
156 | uint64_t io_error; /* i/o error flag */ | |
157 | uint64_t nrpending; /* pending non-resumable on this CPU */ | |
158 | uint64_t rerouted_ehdl; /* EHDL rerouted to this CPU */ | |
159 | uint64_t rerouted_addr; /* PA rerouted to this CPU */ | |
160 | uint64_t rerouted_stick; /* %stick rerouted to this CPU */ | |
161 | uint64_t rerouted_attr; /* ATTR rerouted to this CPU */ | |
162 | uint64_t abort_pc; /* %pc of hvabort caller */ | |
163 | ||
164 | /* | |
165 | * Saved failure state | |
166 | */ | |
167 | uint64_t fail_tl; | |
168 | uint64_t fail_gl; | |
169 | ||
170 | struct trapstate trapstate[MAXTL]; | |
171 | struct trapglobals trapglobals[MAXGL]; | |
172 | ||
173 | /* | |
174 | * This is the real stack used for the C environment | |
175 | */ | |
176 | uint64_t strand_stack[STRAND_STACK_SIZE / sizeof (uint64_t)]; | |
177 | }; | |
178 | ||
179 | extern strand_t strands[]; | |
180 | ||
181 | #endif /* !_ASM */ | |
182 | ||
183 | #ifdef __cplusplus | |
184 | } | |
185 | #endif | |
186 | ||
187 | #endif /* _PLATFORM_STRAND_H */ |