diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-ia64/sn/klconfig.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-ia64/sn/klconfig.h')
-rw-r--r-- | include/asm-ia64/sn/klconfig.h | 272 |
1 files changed, 272 insertions, 0 deletions
diff --git a/include/asm-ia64/sn/klconfig.h b/include/asm-ia64/sn/klconfig.h new file mode 100644 index 000000000000..9f920c70a62a --- /dev/null +++ b/include/asm-ia64/sn/klconfig.h | |||
@@ -0,0 +1,272 @@ | |||
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/klconfig.h>. | ||
7 | * | ||
8 | * Copyright (C) 1992-1997,1999,2001-2004 Silicon Graphics, Inc. All Rights Reserved. | ||
9 | * Copyright (C) 1999 by Ralf Baechle | ||
10 | */ | ||
11 | #ifndef _ASM_IA64_SN_KLCONFIG_H | ||
12 | #define _ASM_IA64_SN_KLCONFIG_H | ||
13 | |||
14 | /* | ||
15 | * The KLCONFIG structures store info about the various BOARDs found | ||
16 | * during Hardware Discovery. In addition, it stores info about the | ||
17 | * components found on the BOARDs. | ||
18 | */ | ||
19 | |||
20 | typedef s32 klconf_off_t; | ||
21 | |||
22 | |||
23 | /* Functions/macros needed to use this structure */ | ||
24 | |||
25 | typedef struct kl_config_hdr { | ||
26 | char pad[20]; | ||
27 | klconf_off_t ch_board_info; /* the link list of boards */ | ||
28 | char pad0[88]; | ||
29 | } kl_config_hdr_t; | ||
30 | |||
31 | |||
32 | #define NODE_OFFSET_TO_LBOARD(nasid,off) (lboard_t*)(GLOBAL_CAC_ADDR((nasid), (off))) | ||
33 | |||
34 | /* | ||
35 | * The KLCONFIG area is organized as a LINKED LIST of BOARDs. A BOARD | ||
36 | * can be either 'LOCAL' or 'REMOTE'. LOCAL means it is attached to | ||
37 | * the LOCAL/current NODE. REMOTE means it is attached to a different | ||
38 | * node.(TBD - Need a way to treat ROUTER boards.) | ||
39 | * | ||
40 | * There are 2 different structures to represent these boards - | ||
41 | * lboard - Local board, rboard - remote board. These 2 structures | ||
42 | * can be arbitrarily mixed in the LINKED LIST of BOARDs. (Refer | ||
43 | * Figure below). The first byte of the rboard or lboard structure | ||
44 | * is used to find out its type - no unions are used. | ||
45 | * If it is a lboard, then the config info of this board will be found | ||
46 | * on the local node. (LOCAL NODE BASE + offset value gives pointer to | ||
47 | * the structure. | ||
48 | * If it is a rboard, the local structure contains the node number | ||
49 | * and the offset of the beginning of the LINKED LIST on the remote node. | ||
50 | * The details of the hardware on a remote node can be built locally, | ||
51 | * if required, by reading the LINKED LIST on the remote node and | ||
52 | * ignoring all the rboards on that node. | ||
53 | * | ||
54 | * The local node uses the REMOTE NODE NUMBER + OFFSET to point to the | ||
55 | * First board info on the remote node. The remote node list is | ||
56 | * traversed as the local list, using the REMOTE BASE ADDRESS and not | ||
57 | * the local base address and ignoring all rboard values. | ||
58 | * | ||
59 | * | ||
60 | KLCONFIG | ||
61 | |||
62 | +------------+ +------------+ +------------+ +------------+ | ||
63 | | lboard | +-->| lboard | +-->| rboard | +-->| lboard | | ||
64 | +------------+ | +------------+ | +------------+ | +------------+ | ||
65 | | board info | | | board info | | |errinfo,bptr| | | board info | | ||
66 | +------------+ | +------------+ | +------------+ | +------------+ | ||
67 | | offset |--+ | offset |--+ | offset |--+ |offset=NULL | | ||
68 | +------------+ +------------+ +------------+ +------------+ | ||
69 | |||
70 | |||
71 | +------------+ | ||
72 | | board info | | ||
73 | +------------+ +--------------------------------+ | ||
74 | | compt 1 |------>| type, rev, diaginfo, size ... | (CPU) | ||
75 | +------------+ +--------------------------------+ | ||
76 | | compt 2 |--+ | ||
77 | +------------+ | +--------------------------------+ | ||
78 | | ... | +--->| type, rev, diaginfo, size ... | (MEM_BANK) | ||
79 | +------------+ +--------------------------------+ | ||
80 | | errinfo |--+ | ||
81 | +------------+ | +--------------------------------+ | ||
82 | +--->|r/l brd errinfo,compt err flags | | ||
83 | +--------------------------------+ | ||
84 | |||
85 | * | ||
86 | * Each BOARD consists of COMPONENTs and the BOARD structure has | ||
87 | * pointers (offsets) to its COMPONENT structure. | ||
88 | * The COMPONENT structure has version info, size and speed info, revision, | ||
89 | * error info and the NIC info. This structure can accommodate any | ||
90 | * BOARD with arbitrary COMPONENT composition. | ||
91 | * | ||
92 | * The ERRORINFO part of each BOARD has error information | ||
93 | * that describes errors about the BOARD itself. It also has flags to | ||
94 | * indicate the COMPONENT(s) on the board that have errors. The error | ||
95 | * information specific to the COMPONENT is present in the respective | ||
96 | * COMPONENT structure. | ||
97 | * | ||
98 | * The ERRORINFO structure is also treated like a COMPONENT, ie. the | ||
99 | * BOARD has pointers(offset) to the ERRORINFO structure. The rboard | ||
100 | * structure also has a pointer to the ERRORINFO structure. This is | ||
101 | * the place to store ERRORINFO about a REMOTE NODE, if the HUB on | ||
102 | * that NODE is not working or if the REMOTE MEMORY is BAD. In cases where | ||
103 | * only the CPU of the REMOTE NODE is disabled, the ERRORINFO pointer can | ||
104 | * be a NODE NUMBER, REMOTE OFFSET combination, pointing to error info | ||
105 | * which is present on the REMOTE NODE.(TBD) | ||
106 | * REMOTE ERRINFO can be stored on any of the nearest nodes | ||
107 | * or on all the nearest nodes.(TBD) | ||
108 | * Like BOARD structures, REMOTE ERRINFO structures can be built locally | ||
109 | * using the rboard errinfo pointer. | ||
110 | * | ||
111 | * In order to get useful information from this Data organization, a set of | ||
112 | * interface routines are provided (TBD). The important thing to remember while | ||
113 | * manipulating the structures, is that, the NODE number information should | ||
114 | * be used. If the NODE is non-zero (remote) then each offset should | ||
115 | * be added to the REMOTE BASE ADDR else it should be added to the LOCAL BASE ADDR. | ||
116 | * This includes offsets for BOARDS, COMPONENTS and ERRORINFO. | ||
117 | * | ||
118 | * Note that these structures do not provide much info about connectivity. | ||
119 | * That info will be part of HWGRAPH, which is an extension of the cfg_t | ||
120 | * data structure. (ref IP27prom/cfg.h) It has to be extended to include | ||
121 | * the IO part of the Network(TBD). | ||
122 | * | ||
123 | * The data structures below define the above concepts. | ||
124 | */ | ||
125 | |||
126 | |||
127 | /* | ||
128 | * BOARD classes | ||
129 | */ | ||
130 | |||
131 | #define KLCLASS_MASK 0xf0 | ||
132 | #define KLCLASS_NONE 0x00 | ||
133 | #define KLCLASS_NODE 0x10 /* CPU, Memory and HUB board */ | ||
134 | #define KLCLASS_CPU KLCLASS_NODE | ||
135 | #define KLCLASS_IO 0x20 /* BaseIO, 4 ch SCSI, ethernet, FDDI | ||
136 | and the non-graphics widget boards */ | ||
137 | #define KLCLASS_ROUTER 0x30 /* Router board */ | ||
138 | #define KLCLASS_MIDPLANE 0x40 /* We need to treat this as a board | ||
139 | so that we can record error info */ | ||
140 | #define KLCLASS_IOBRICK 0x70 /* IP35 iobrick */ | ||
141 | #define KLCLASS_MAX 8 /* Bump this if a new CLASS is added */ | ||
142 | |||
143 | #define KLCLASS(_x) ((_x) & KLCLASS_MASK) | ||
144 | |||
145 | |||
146 | /* | ||
147 | * board types | ||
148 | */ | ||
149 | |||
150 | #define KLTYPE_MASK 0x0f | ||
151 | #define KLTYPE(_x) ((_x) & KLTYPE_MASK) | ||
152 | |||
153 | #define KLTYPE_SNIA (KLCLASS_CPU | 0x1) | ||
154 | #define KLTYPE_TIO (KLCLASS_CPU | 0x2) | ||
155 | |||
156 | #define KLTYPE_ROUTER (KLCLASS_ROUTER | 0x1) | ||
157 | #define KLTYPE_META_ROUTER (KLCLASS_ROUTER | 0x3) | ||
158 | #define KLTYPE_REPEATER_ROUTER (KLCLASS_ROUTER | 0x4) | ||
159 | |||
160 | #define KLTYPE_IOBRICK_XBOW (KLCLASS_MIDPLANE | 0x2) | ||
161 | |||
162 | #define KLTYPE_IOBRICK (KLCLASS_IOBRICK | 0x0) | ||
163 | #define KLTYPE_NBRICK (KLCLASS_IOBRICK | 0x4) | ||
164 | #define KLTYPE_PXBRICK (KLCLASS_IOBRICK | 0x6) | ||
165 | #define KLTYPE_IXBRICK (KLCLASS_IOBRICK | 0x7) | ||
166 | #define KLTYPE_CGBRICK (KLCLASS_IOBRICK | 0x8) | ||
167 | #define KLTYPE_OPUSBRICK (KLCLASS_IOBRICK | 0x9) | ||
168 | #define KLTYPE_SABRICK (KLCLASS_IOBRICK | 0xa) | ||
169 | #define KLTYPE_IABRICK (KLCLASS_IOBRICK | 0xb) | ||
170 | #define KLTYPE_PABRICK (KLCLASS_IOBRICK | 0xc) | ||
171 | #define KLTYPE_GABRICK (KLCLASS_IOBRICK | 0xd) | ||
172 | |||
173 | |||
174 | /* | ||
175 | * board structures | ||
176 | */ | ||
177 | |||
178 | #define MAX_COMPTS_PER_BRD 24 | ||
179 | |||
180 | typedef struct lboard_s { | ||
181 | klconf_off_t brd_next_any; /* Next BOARD */ | ||
182 | unsigned char struct_type; /* type of structure, local or remote */ | ||
183 | unsigned char brd_type; /* type+class */ | ||
184 | unsigned char brd_sversion; /* version of this structure */ | ||
185 | unsigned char brd_brevision; /* board revision */ | ||
186 | unsigned char brd_promver; /* board prom version, if any */ | ||
187 | unsigned char brd_flags; /* Enabled, Disabled etc */ | ||
188 | unsigned char brd_slot; /* slot number */ | ||
189 | unsigned short brd_debugsw; /* Debug switches */ | ||
190 | geoid_t brd_geoid; /* geo id */ | ||
191 | partid_t brd_partition; /* Partition number */ | ||
192 | unsigned short brd_diagval; /* diagnostic value */ | ||
193 | unsigned short brd_diagparm; /* diagnostic parameter */ | ||
194 | unsigned char brd_inventory; /* inventory history */ | ||
195 | unsigned char brd_numcompts; /* Number of components */ | ||
196 | nic_t brd_nic; /* Number in CAN */ | ||
197 | nasid_t brd_nasid; /* passed parameter */ | ||
198 | klconf_off_t brd_compts[MAX_COMPTS_PER_BRD]; /* pointers to COMPONENTS */ | ||
199 | klconf_off_t brd_errinfo; /* Board's error information */ | ||
200 | struct lboard_s *brd_parent; /* Logical parent for this brd */ | ||
201 | char pad0[4]; | ||
202 | unsigned char brd_confidence; /* confidence that the board is bad */ | ||
203 | nasid_t brd_owner; /* who owns this board */ | ||
204 | unsigned char brd_nic_flags; /* To handle 8 more NICs */ | ||
205 | char pad1[24]; /* future expansion */ | ||
206 | char brd_name[32]; | ||
207 | nasid_t brd_next_same_host; /* host of next brd w/same nasid */ | ||
208 | klconf_off_t brd_next_same; /* Next BOARD with same nasid */ | ||
209 | } lboard_t; | ||
210 | |||
211 | #define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts) | ||
212 | #define NODE_OFFSET_TO_KLINFO(n,off) ((klinfo_t*) TO_NODE_CAC(n,off)) | ||
213 | #define KLCF_NEXT(_brd) \ | ||
214 | ((_brd)->brd_next_same ? \ | ||
215 | (NODE_OFFSET_TO_LBOARD((_brd)->brd_next_same_host, (_brd)->brd_next_same)): NULL) | ||
216 | #define KLCF_NEXT_ANY(_brd) \ | ||
217 | ((_brd)->brd_next_any ? \ | ||
218 | (NODE_OFFSET_TO_LBOARD(NASID_GET(_brd), (_brd)->brd_next_any)): NULL) | ||
219 | #define KLCF_COMP(_brd, _ndx) \ | ||
220 | ((((_brd)->brd_compts[(_ndx)]) == 0) ? 0 : \ | ||
221 | (NODE_OFFSET_TO_KLINFO(NASID_GET(_brd), (_brd)->brd_compts[(_ndx)]))) | ||
222 | |||
223 | |||
224 | /* | ||
225 | * Generic info structure. This stores common info about a | ||
226 | * component. | ||
227 | */ | ||
228 | |||
229 | typedef struct klinfo_s { /* Generic info */ | ||
230 | unsigned char struct_type; /* type of this structure */ | ||
231 | unsigned char struct_version; /* version of this structure */ | ||
232 | unsigned char flags; /* Enabled, disabled etc */ | ||
233 | unsigned char revision; /* component revision */ | ||
234 | unsigned short diagval; /* result of diagnostics */ | ||
235 | unsigned short diagparm; /* diagnostic parameter */ | ||
236 | unsigned char inventory; /* previous inventory status */ | ||
237 | unsigned short partid; /* widget part number */ | ||
238 | nic_t nic; /* MUst be aligned properly */ | ||
239 | unsigned char physid; /* physical id of component */ | ||
240 | unsigned int virtid; /* virtual id as seen by system */ | ||
241 | unsigned char widid; /* Widget id - if applicable */ | ||
242 | nasid_t nasid; /* node number - from parent */ | ||
243 | char pad1; /* pad out structure. */ | ||
244 | char pad2; /* pad out structure. */ | ||
245 | void *data; | ||
246 | klconf_off_t errinfo; /* component specific errors */ | ||
247 | unsigned short pad3; /* pci fields have moved over to */ | ||
248 | unsigned short pad4; /* klbri_t */ | ||
249 | } klinfo_t ; | ||
250 | |||
251 | |||
252 | static inline lboard_t *find_lboard_any(lboard_t * start, unsigned char brd_type) | ||
253 | { | ||
254 | /* Search all boards stored on this node. */ | ||
255 | |||
256 | while (start) { | ||
257 | if (start->brd_type == brd_type) | ||
258 | return start; | ||
259 | start = KLCF_NEXT_ANY(start); | ||
260 | } | ||
261 | /* Didn't find it. */ | ||
262 | return (lboard_t *) NULL; | ||
263 | } | ||
264 | |||
265 | |||
266 | /* external declarations of Linux kernel functions. */ | ||
267 | |||
268 | extern lboard_t *root_lboard[]; | ||
269 | extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type); | ||
270 | extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type); | ||
271 | |||
272 | #endif /* _ASM_IA64_SN_KLCONFIG_H */ | ||