Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-ia64 / sn / klconfig.h
blob9f920c70a62a480e092a1485287fb75f46bacb7a
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.
6 * Derived from IRIX <sys/SN/klconfig.h>.
8 * Copyright (C) 1992-1997,1999,2001-2004 Silicon Graphics, Inc. All Rights Reserved.
9 * Copyright (C) 1999 by Ralf Baechle
11 #ifndef _ASM_IA64_SN_KLCONFIG_H
12 #define _ASM_IA64_SN_KLCONFIG_H
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.
20 typedef s32 klconf_off_t;
23 /* Functions/macros needed to use this structure */
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;
32 #define NODE_OFFSET_TO_LBOARD(nasid,off) (lboard_t*)(GLOBAL_CAC_ADDR((nasid), (off)))
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.)
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.
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.
60 KLCONFIG
62 +------------+ +------------+ +------------+ +------------+
63 | lboard | +-->| lboard | +-->| rboard | +-->| lboard |
64 +------------+ | +------------+ | +------------+ | +------------+
65 | board info | | | board info | | |errinfo,bptr| | | board info |
66 +------------+ | +------------+ | +------------+ | +------------+
67 | offset |--+ | offset |--+ | offset |--+ |offset=NULL |
68 +------------+ +------------+ +------------+ +------------+
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 +--------------------------------+
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.
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.
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.
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.
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).
123 * The data structures below define the above concepts.
128 * BOARD classes
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 */
143 #define KLCLASS(_x) ((_x) & KLCLASS_MASK)
147 * board types
150 #define KLTYPE_MASK 0x0f
151 #define KLTYPE(_x) ((_x) & KLTYPE_MASK)
153 #define KLTYPE_SNIA (KLCLASS_CPU | 0x1)
154 #define KLTYPE_TIO (KLCLASS_CPU | 0x2)
156 #define KLTYPE_ROUTER (KLCLASS_ROUTER | 0x1)
157 #define KLTYPE_META_ROUTER (KLCLASS_ROUTER | 0x3)
158 #define KLTYPE_REPEATER_ROUTER (KLCLASS_ROUTER | 0x4)
160 #define KLTYPE_IOBRICK_XBOW (KLCLASS_MIDPLANE | 0x2)
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)
175 * board structures
178 #define MAX_COMPTS_PER_BRD 24
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;
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)])))
225 * Generic info structure. This stores common info about a
226 * component.
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 ;
252 static inline lboard_t *find_lboard_any(lboard_t * start, unsigned char brd_type)
254 /* Search all boards stored on this node. */
256 while (start) {
257 if (start->brd_type == brd_type)
258 return start;
259 start = KLCF_NEXT_ANY(start);
261 /* Didn't find it. */
262 return (lboard_t *) NULL;
266 /* external declarations of Linux kernel functions. */
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);
272 #endif /* _ASM_IA64_SN_KLCONFIG_H */