3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
7 * Derived from IRIX <sys/SN/klconfig.h>.
9 * Copyright (C) 1992-1997,1999,2001-2002 Silicon Graphics, Inc. All Rights Reserved.
10 * Copyright (C) 1999 by Ralf Baechle
12 #ifndef _ASM_IA64_SN_KLCONFIG_H
13 #define _ASM_IA64_SN_KLCONFIG_H
15 #include <linux/config.h>
22 * The KLCONFIG structures store info about the various BOARDs found
23 * during Hardware Discovery. In addition, it stores info about the
24 * components found on the BOARDs.
29 * Certain assembly language routines (notably xxxxx.s) in the IP27PROM
30 * will depend on the format of the data structures in this file. In
31 * most cases, rearranging the fields can seriously break things.
32 * Adding fields in the beginning or middle can also break things.
33 * Add fields if necessary, to the end of a struct in such a way
34 * that offsets of existing fields do not change.
37 #include <linux/types.h>
38 #include <asm/sn/types.h>
39 #include <asm/sn/slotnum.h>
40 #include <asm/sn/router.h>
41 #include <asm/sn/sgi.h>
42 #include <asm/sn/addrs.h>
43 #include <asm/sn/vector.h>
44 #include <asm/sn/arc/hinv.h>
45 #include <asm/sn/xtalk/xbow.h>
46 #include <asm/sn/xtalk/xtalk.h>
47 #include <asm/sn/kldir.h>
48 #include <asm/sn/sn_fru.h>
50 #ifdef CONFIG_IA64_SGI_SN1
51 #include <asm/sn/sn1/hubmd_next.h>
54 #ifdef CONFIG_IA64_SGI_SN2
55 #include <asm/sn/sn2/shub_md.h>
58 #ifdef CONFIG_IA64_SGI_SN2
59 #include <asm/sn/geo.h>
62 #define KLCFGINFO_MAGIC 0xbeedbabe
64 typedef s32 klconf_off_t;
66 #define MAX_MODULE_ID 255
67 #define SIZE_PAD 4096 /* 4k padding for structures */
69 * 1 NODE brick, 3 Router bricks (1 local, 1 meta, 1 repeater),
70 * 6 XIO Widgets, 1 Xbow, 1 gfx
72 #define MAX_SLOTS_PER_NODE (1 + 3 + 6 + 1 + 1)
74 /* XXX if each node is guranteed to have some memory */
76 #define MAX_PCI_DEVS 8
78 /* lboard_t->brd_flags fields */
79 /* All bits in this field are currently used. Try the pad fields if
80 you need more flag bits */
82 #define ENABLE_BOARD 0x01
83 #define FAILED_BOARD 0x02
84 #define DUPLICATE_BOARD 0x04 /* Boards like midplanes/routers which
85 are discovered twice. Use one of them */
86 #define VISITED_BOARD 0x08 /* Used for compact hub numbering. */
87 #define LOCAL_MASTER_IO6 0x10 /* master io6 for that node */
88 #define GLOBAL_MASTER_IO6 0x20
89 #define GLOBAL_MASTER_EXT 0x40 /* extend master io6 to other bus on ibrick */
90 #define SECOND_NIC_PRESENT 0x80 /* addons like MIO are present */
92 /* klinfo->flags fields */
94 #define KLINFO_ENABLE 0x01 /* This component is enabled */
95 #define KLINFO_FAILED 0x02 /* This component failed */
96 #define KLINFO_DEVICE 0x04 /* This component is a device */
97 #define KLINFO_VISITED 0x08 /* This component has been visited */
98 #define KLINFO_CONTROLLER 0x10 /* This component is a device controller */
99 #define KLINFO_INSTALL 0x20 /* Install a driver */
100 #define KLINFO_HEADLESS 0x40 /* Headless (or hubless) component */
101 #define IS_CONSOLE_IOC3(i) ((((klinfo_t *)i)->flags) & KLINFO_INSTALL)
103 #define GB2 0x80000000
105 #define MAX_RSV_PTRS 32
107 /* Structures to manage various data storage areas */
108 /* The numbers must be contiguous since the array index i
109 is used in the code to allocate various areas.
112 #define BOARD_STRUCT 0
113 #define COMPONENT_STRUCT 1
114 #define ERRINFO_STRUCT 2
115 #define KLMALLOC_TYPE_MAX (ERRINFO_STRUCT + 1)
116 #define DEVICE_STRUCT 3
119 typedef struct console_s {
120 __psunsigned_t uart_base;
121 __psunsigned_t config_base;
122 __psunsigned_t memory_base;
132 typedef struct klc_malloc_hdr {
133 klconf_off_t km_base;
134 klconf_off_t km_limit;
135 klconf_off_t km_current;
138 /* Functions/macros needed to use this structure */
140 typedef struct kl_config_hdr {
141 u64 ch_magic; /* set this to KLCFGINFO_MAGIC */
142 u32 ch_version; /* structure version number */
143 klconf_off_t ch_malloc_hdr_off; /* offset of ch_malloc_hdr */
144 klconf_off_t ch_cons_off; /* offset of ch_cons */
145 klconf_off_t ch_board_info; /* the link list of boards */
146 console_t ch_cons_info; /* address info of the console */
147 klc_malloc_hdr_t ch_malloc_hdr[KLMALLOC_TYPE_MAX];
148 confidence_t ch_sw_belief; /* confidence that software is bad*/
149 confidence_t ch_sn0net_belief; /* confidence that sn0net is bad */
153 #define KL_CONFIG_HDR(_nasid) ((kl_config_hdr_t *)(KLCONFIG_ADDR(_nasid)))
154 #define KL_CONFIG_INFO_OFFSET(_nasid) \
155 (KL_CONFIG_HDR(_nasid)->ch_board_info)
156 #define KL_CONFIG_INFO_SET_OFFSET(_nasid, _off) \
157 (KL_CONFIG_HDR(_nasid)->ch_board_info = (_off))
160 #define KL_CONFIG_INFO(_nasid) \
161 (lboard_t *)((KL_CONFIG_HDR(_nasid)->ch_board_info) ? \
162 NODE_OFFSET_TO_K0((_nasid), KL_CONFIG_HDR(_nasid)->ch_board_info) : \
165 #define NODE_OFFSET_TO_LBOARD(nasid,off) (lboard_t*)(NODE_CAC_BASE(nasid) + (off))
167 #define KL_CONFIG_INFO(_nasid) \
168 (lboard_t *)((KL_CONFIG_HDR(_nasid)->ch_board_info) ? \
169 NODE_OFFSET_TO_LBOARD((_nasid), KL_CONFIG_HDR(_nasid)->ch_board_info) : \
174 #define KL_CONFIG_MAGIC(_nasid) (KL_CONFIG_HDR(_nasid)->ch_magic)
176 #define KL_CONFIG_CHECK_MAGIC(_nasid) \
177 (KL_CONFIG_HDR(_nasid)->ch_magic == KLCFGINFO_MAGIC)
179 #define KL_CONFIG_HDR_INIT_MAGIC(_nasid) \
180 (KL_CONFIG_HDR(_nasid)->ch_magic = KLCFGINFO_MAGIC)
182 /* --- New Macros for the changed kl_config_hdr_t structure --- */
184 #define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\
185 ((__psunsigned_t)_k + (_k->ch_malloc_hdr_off)))
187 #define KL_CONFIG_CH_MALLOC_HDR(_n) PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))
189 #define PTR_CH_CONS_INFO(_k) ((console_t *)\
190 ((__psunsigned_t)_k + (_k->ch_cons_off)))
192 #define KL_CONFIG_CH_CONS_INFO(_n) PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n))
194 /* ------------------------------------------------------------- */
196 #define KL_CONFIG_INFO_START(_nasid) \
197 (klconf_off_t)(KLCONFIG_OFFSET(_nasid) + sizeof(kl_config_hdr_t))
199 #define KL_CONFIG_BOARD_NASID(_brd) ((_brd)->brd_nasid)
200 #define KL_CONFIG_BOARD_SET_NEXT(_brd, _off) ((_brd)->brd_next = (_off))
202 #define KL_CONFIG_DUPLICATE_BOARD(_brd) ((_brd)->brd_flags & DUPLICATE_BOARD)
204 #define XBOW_PORT_TYPE_HUB(_xbowp, _link) \
205 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_HUB)
206 #define XBOW_PORT_TYPE_IO(_xbowp, _link) \
207 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_IO)
209 #define XBOW_PORT_IS_ENABLED(_xbowp, _link) \
210 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_ENABLE)
211 #define XBOW_PORT_NASID(_xbowp, _link) \
212 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_nasid)
214 #define XBOW_PORT_IO 0x1
215 #define XBOW_PORT_HUB 0x2
216 #define XBOW_PORT_ENABLE 0x4
218 #define SN0_PORT_FENCE_SHFT 0
219 #define SN0_PORT_FENCE_MASK (1 << SN0_PORT_FENCE_SHFT)
222 * The KLCONFIG area is organized as a LINKED LIST of BOARDs. A BOARD
223 * can be either 'LOCAL' or 'REMOTE'. LOCAL means it is attached to
224 * the LOCAL/current NODE. REMOTE means it is attached to a different
225 * node.(TBD - Need a way to treat ROUTER boards.)
227 * There are 2 different structures to represent these boards -
228 * lboard - Local board, rboard - remote board. These 2 structures
229 * can be arbitrarily mixed in the LINKED LIST of BOARDs. (Refer
230 * Figure below). The first byte of the rboard or lboard structure
231 * is used to find out its type - no unions are used.
232 * If it is a lboard, then the config info of this board will be found
233 * on the local node. (LOCAL NODE BASE + offset value gives pointer to
235 * If it is a rboard, the local structure contains the node number
236 * and the offset of the beginning of the LINKED LIST on the remote node.
237 * The details of the hardware on a remote node can be built locally,
238 * if required, by reading the LINKED LIST on the remote node and
239 * ignoring all the rboards on that node.
241 * The local node uses the REMOTE NODE NUMBER + OFFSET to point to the
242 * First board info on the remote node. The remote node list is
243 * traversed as the local list, using the REMOTE BASE ADDRESS and not
244 * the local base address and ignoring all rboard values.
249 +------------+ +------------+ +------------+ +------------+
250 | lboard | +-->| lboard | +-->| rboard | +-->| lboard |
251 +------------+ | +------------+ | +------------+ | +------------+
252 | board info | | | board info | | |errinfo,bptr| | | board info |
253 +------------+ | +------------+ | +------------+ | +------------+
254 | offset |--+ | offset |--+ | offset |--+ |offset=NULL |
255 +------------+ +------------+ +------------+ +------------+
260 +------------+ +--------------------------------+
261 | compt 1 |------>| type, rev, diaginfo, size ... | (CPU)
262 +------------+ +--------------------------------+
264 +------------+ | +--------------------------------+
265 | ... | +--->| type, rev, diaginfo, size ... | (MEM_BANK)
266 +------------+ +--------------------------------+
268 +------------+ | +--------------------------------+
269 +--->|r/l brd errinfo,compt err flags |
270 +--------------------------------+
273 * Each BOARD consists of COMPONENTs and the BOARD structure has
274 * pointers (offsets) to its COMPONENT structure.
275 * The COMPONENT structure has version info, size and speed info, revision,
276 * error info and the NIC info. This structure can accommodate any
277 * BOARD with arbitrary COMPONENT composition.
279 * The ERRORINFO part of each BOARD has error information
280 * that describes errors about the BOARD itself. It also has flags to
281 * indicate the COMPONENT(s) on the board that have errors. The error
282 * information specific to the COMPONENT is present in the respective
283 * COMPONENT structure.
285 * The ERRORINFO structure is also treated like a COMPONENT, ie. the
286 * BOARD has pointers(offset) to the ERRORINFO structure. The rboard
287 * structure also has a pointer to the ERRORINFO structure. This is
288 * the place to store ERRORINFO about a REMOTE NODE, if the HUB on
289 * that NODE is not working or if the REMOTE MEMORY is BAD. In cases where
290 * only the CPU of the REMOTE NODE is disabled, the ERRORINFO pointer can
291 * be a NODE NUMBER, REMOTE OFFSET combination, pointing to error info
292 * which is present on the REMOTE NODE.(TBD)
293 * REMOTE ERRINFO can be stored on any of the nearest nodes
294 * or on all the nearest nodes.(TBD)
295 * Like BOARD structures, REMOTE ERRINFO structures can be built locally
296 * using the rboard errinfo pointer.
298 * In order to get useful information from this Data organization, a set of
299 * interface routines are provided (TBD). The important thing to remember while
300 * manipulating the structures, is that, the NODE number information should
301 * be used. If the NODE is non-zero (remote) then each offset should
302 * be added to the REMOTE BASE ADDR else it should be added to the LOCAL BASE ADDR.
303 * This includes offsets for BOARDS, COMPONENTS and ERRORINFO.
305 * Note that these structures do not provide much info about connectivity.
306 * That info will be part of HWGRAPH, which is an extension of the cfg_t
307 * data structure. (ref IP27prom/cfg.h) It has to be extended to include
308 * the IO part of the Network(TBD).
310 * The data structures below define the above concepts.
314 * Values for CPU types
316 #define KL_CPU_R4000 0x1 /* Standard R4000 */
317 #define KL_CPU_TFP 0x2 /* TFP processor */
318 #define KL_CPU_R10000 0x3 /* R10000 (T5) */
319 #define KL_CPU_NONE (-1) /* no cpu present in slot */
325 #define KLCLASS_MASK 0xf0
326 #define KLCLASS_NONE 0x00
327 #define KLCLASS_NODE 0x10 /* CPU, Memory and HUB board */
328 #define KLCLASS_CPU KLCLASS_NODE
329 #define KLCLASS_IO 0x20 /* BaseIO, 4 ch SCSI, ethernet, FDDI
330 and the non-graphics widget boards */
331 #define KLCLASS_ROUTER 0x30 /* Router board */
332 #define KLCLASS_MIDPLANE 0x40 /* We need to treat this as a board
333 so that we can record error info */
334 #define KLCLASS_GFX 0x50 /* graphics boards */
336 #define KLCLASS_PSEUDO_GFX 0x60 /* HDTV type cards that use a gfx
337 * hw ifc to xtalk and are not gfx
338 * class for sw purposes */
340 #define KLCLASS_IOBRICK 0x70 /* IP35 iobrick */
342 #define KLCLASS_MAX 8 /* Bump this if a new CLASS is added */
343 #define KLTYPE_MAX 11 /* Bump this if a new CLASS is added */
345 #define KLCLASS_UNKNOWN 0xf0
347 #define KLCLASS(_x) ((_x) & KLCLASS_MASK)
353 #define KLTYPE_MASK 0x0f
354 #define KLTYPE_NONE 0x00
355 #define KLTYPE_EMPTY 0x00
357 #define KLTYPE_WEIRDCPU (KLCLASS_CPU | 0x0)
358 #define KLTYPE_SNIA (KLCLASS_CPU | 0x1)
360 #define KLTYPE_WEIRDIO (KLCLASS_IOBRICK | 0x0)
361 #define KLTYPE_BASEIO (KLCLASS_IO | 0x1) /* IOC3, SuperIO, Bridge, SCSI */
362 #define KLTYPE_IO6 KLTYPE_BASEIO /* Additional name */
363 #define KLTYPE_4CHSCSI (KLCLASS_IO | 0x2)
364 #define KLTYPE_MSCSI KLTYPE_4CHSCSI /* Additional name */
365 #define KLTYPE_ETHERNET (KLCLASS_IO | 0x3)
366 #define KLTYPE_MENET KLTYPE_ETHERNET /* Additional name */
367 #define KLTYPE_FDDI (KLCLASS_IO | 0x4)
368 #define KLTYPE_UNUSED (KLCLASS_IO | 0x5) /* XXX UNUSED */
369 #define KLTYPE_HAROLD (KLCLASS_IO | 0x6) /* PCI SHOE BOX */
370 #define KLTYPE_PCI KLTYPE_HAROLD
371 #define KLTYPE_VME (KLCLASS_IO | 0x7) /* Any 3rd party VME card */
372 #define KLTYPE_MIO (KLCLASS_IO | 0x8)
373 #define KLTYPE_FC (KLCLASS_IO | 0x9)
374 #define KLTYPE_LINC (KLCLASS_IO | 0xA)
375 #define KLTYPE_TPU (KLCLASS_IO | 0xB) /* Tensor Processing Unit */
376 #define KLTYPE_GSN_A (KLCLASS_IO | 0xC) /* Main GSN board */
377 #define KLTYPE_GSN_B (KLCLASS_IO | 0xD) /* Auxiliary GSN board */
378 #define KLTYPE_SHOEHORN (KLCLASS_IO | 0xE)
379 #define KLTYPE_SERIAL_HIPPI (KLCLASS_IO | 0xF)
381 #define KLTYPE_GFX (KLCLASS_GFX | 0x0) /* unknown graphics type */
382 #define KLTYPE_GFX_KONA (KLCLASS_GFX | 0x1) /* KONA graphics on IP27 */
383 #define KLTYPE_GFX_MGRA (KLCLASS_GFX | 0x3) /* MGRAS graphics on IP27 */
385 #define KLTYPE_WEIRDROUTER (KLCLASS_ROUTER | 0x0)
386 #define KLTYPE_ROUTER (KLCLASS_ROUTER | 0x1)
387 #define KLTYPE_ROUTER2 KLTYPE_ROUTER /* Obsolete! */
388 #define KLTYPE_NULL_ROUTER (KLCLASS_ROUTER | 0x2)
389 #define KLTYPE_META_ROUTER (KLCLASS_ROUTER | 0x3)
390 #define KLTYPE_REPEATER_ROUTER (KLCLASS_ROUTER | 0x4)
392 #define KLTYPE_WEIRDMIDPLANE (KLCLASS_MIDPLANE | 0x0)
393 #define KLTYPE_MIDPLANE8 (KLCLASS_MIDPLANE | 0x1) /* 8 slot backplane */
394 #define KLTYPE_MIDPLANE KLTYPE_MIDPLANE8
395 #define KLTYPE_IOBRICK_XBOW (KLCLASS_MIDPLANE | 0x2)
397 #define KLTYPE_IOBRICK (KLCLASS_IOBRICK | 0x0)
398 #define KLTYPE_IBRICK (KLCLASS_IOBRICK | 0x1)
399 #define KLTYPE_PBRICK (KLCLASS_IOBRICK | 0x2)
400 #define KLTYPE_XBRICK (KLCLASS_IOBRICK | 0x3)
402 #define KLTYPE_PBRICK_BRIDGE KLTYPE_PBRICK
404 /* The value of type should be more than 8 so that hinv prints
405 * out the board name from the NIC string. For values less than
406 * 8 the name of the board needs to be hard coded in a few places.
407 * When bringup started nic names had not standardized and so we
408 * had to hard code. (For people interested in history.)
410 #define KLTYPE_XTHD (KLCLASS_PSEUDO_GFX | 0x9)
412 #define KLTYPE_UNKNOWN (KLCLASS_UNKNOWN | 0xf)
414 #define KLTYPE(_x) ((_x) & KLTYPE_MASK)
415 #define IS_MIO_PRESENT(l) ((l->brd_type == KLTYPE_BASEIO) && \
416 (l->brd_flags & SECOND_NIC_PRESENT))
417 #define IS_MIO_IOC3(l,n) (IS_MIO_PRESENT(l) && (n > 2))
423 #define MAX_COMPTS_PER_BRD 24
425 #define LOCAL_BOARD 1
426 #define REMOTE_BOARD 2
428 #define LBOARD_STRUCT_VERSION 2
430 typedef struct lboard_s {
431 klconf_off_t brd_next; /* Next BOARD */
432 unsigned char struct_type; /* type of structure, local or remote */
433 unsigned char brd_type; /* type+class */
434 unsigned char brd_sversion; /* version of this structure */
435 unsigned char brd_brevision; /* board revision */
436 unsigned char brd_promver; /* board prom version, if any */
437 unsigned char brd_flags; /* Enabled, Disabled etc */
438 unsigned char brd_slot; /* slot number */
439 unsigned short brd_debugsw; /* Debug switches */
440 #ifdef CONFIG_IA64_SGI_SN2
441 geoid_t brd_geoid; /* geo id */
443 moduleid_t brd_module; /* module to which it belongs */
445 partid_t brd_partition; /* Partition number */
446 unsigned short brd_diagval; /* diagnostic value */
447 unsigned short brd_diagparm; /* diagnostic parameter */
448 unsigned char brd_inventory; /* inventory history */
449 unsigned char brd_numcompts; /* Number of components */
450 nic_t brd_nic; /* Number in CAN */
451 nasid_t brd_nasid; /* passed parameter */
452 klconf_off_t brd_compts[MAX_COMPTS_PER_BRD]; /* pointers to COMPONENTS */
453 klconf_off_t brd_errinfo; /* Board's error information */
454 struct lboard_s *brd_parent; /* Logical parent for this brd */
455 devfs_handle_t brd_graph_link; /* vertex hdl to connect extern compts */
456 confidence_t brd_confidence; /* confidence that the board is bad */
457 nasid_t brd_owner; /* who owns this board */
458 unsigned char brd_nic_flags; /* To handle 8 more NICs */
459 #ifdef CONFIG_IA64_SGI_SN2
460 char pad[32]; /* future expansion */
467 * Make sure we pass back the calias space address for local boards.
468 * klconfig board traversal and error structure extraction defines.
471 #define BOARD_SLOT(_brd) ((_brd)->brd_slot)
473 #define KLCF_CLASS(_brd) KLCLASS((_brd)->brd_type)
474 #define KLCF_TYPE(_brd) KLTYPE((_brd)->brd_type)
475 #define KLCF_REMOTE(_brd) (((_brd)->struct_type & LOCAL_BOARD) ? 0 : 1)
476 #define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts)
477 #define KLCF_MODULE_ID(_brd) ((_brd)->brd_module)
480 #define KLCF_NEXT(_brd) ((_brd)->brd_next ? (lboard_t *)((_brd)->brd_next): NULL)
481 #define KLCF_COMP(_brd, _ndx) \
482 (klinfo_t *)(NODE_OFFSET_TO_K0(NASID_GET(_brd), \
483 (_brd)->brd_compts[(_ndx)]))
484 #define KLCF_COMP_ERROR(_brd, _comp) \
485 (NODE_OFFSET_TO_K0(NASID_GET(_brd), (_comp)->errinfo))
489 #define NODE_OFFSET_TO_KLINFO(n,off) ((klinfo_t*) TO_NODE_CAC(n,off))
490 #define KLCF_NEXT(_brd) \
491 ((_brd)->brd_next ? \
492 (NODE_OFFSET_TO_LBOARD(NASID_GET(_brd), (_brd)->brd_next)): NULL)
493 #define KLCF_COMP(_brd, _ndx) \
494 (NODE_OFFSET_TO_KLINFO(NASID_GET(_brd), (_brd)->brd_compts[(_ndx)]))
496 #define KLCF_COMP_ERROR(_brd, _comp) \
497 (NODE_OFFSET_TO_K0(NASID_GET(_brd), (_comp)->errinfo))
501 #define KLCF_COMP_TYPE(_comp) ((_comp)->struct_type)
502 #define KLCF_BRIDGE_W_ID(_comp) ((_comp)->physid) /* Widget ID */
507 * Generic info structure. This stores common info about a
511 typedef struct klinfo_s { /* Generic info */
512 unsigned char struct_type; /* type of this structure */
513 unsigned char struct_version; /* version of this structure */
514 unsigned char flags; /* Enabled, disabled etc */
515 unsigned char revision; /* component revision */
516 unsigned short diagval; /* result of diagnostics */
517 unsigned short diagparm; /* diagnostic parameter */
518 unsigned char inventory; /* previous inventory status */
519 unsigned short partid; /* widget part number */
520 nic_t nic; /* MUst be aligned properly */
521 unsigned char physid; /* physical id of component */
522 unsigned int virtid; /* virtual id as seen by system */
523 unsigned char widid; /* Widget id - if applicable */
524 nasid_t nasid; /* node number - from parent */
525 char pad1; /* pad out structure. */
526 char pad2; /* pad out structure. */
527 COMPONENT *arcs_compt; /* ptr to the arcs struct for ease*/
528 klconf_off_t errinfo; /* component specific errors */
529 unsigned short pad3; /* pci fields have moved over to */
530 unsigned short pad4; /* klbri_t */
533 #define KLCONFIG_INFO_ENABLED(_i) ((_i)->flags & KLINFO_ENABLE)
535 * Component structures.
536 * Following are the currently identified components:
537 * CPU, HUB, MEM_BANK,
538 * XBOW(consists of 16 WIDGETs, each of which can be HUB or GRAPHICS or BRIDGE)
539 * BRIDGE, IOC3, SuperIO, SCSI, FDDI
543 #define KLSTRUCT_UNKNOWN 0
544 #define KLSTRUCT_CPU 1
545 #define KLSTRUCT_HUB 2
546 #define KLSTRUCT_MEMBNK 3
547 #define KLSTRUCT_XBOW 4
548 #define KLSTRUCT_BRI 5
549 #define KLSTRUCT_IOC3 6
550 #define KLSTRUCT_PCI 7
551 #define KLSTRUCT_VME 8
552 #define KLSTRUCT_ROU 9
553 #define KLSTRUCT_GFX 10
554 #define KLSTRUCT_SCSI 11
555 #define KLSTRUCT_FDDI 12
556 #define KLSTRUCT_MIO 13
557 #define KLSTRUCT_DISK 14
558 #define KLSTRUCT_TAPE 15
559 #define KLSTRUCT_CDROM 16
560 #define KLSTRUCT_HUB_UART 17
561 #define KLSTRUCT_IOC3ENET 18
562 #define KLSTRUCT_IOC3UART 19
563 #define KLSTRUCT_UNUSED 20 /* XXX UNUSED */
564 #define KLSTRUCT_IOC3PCKM 21
565 #define KLSTRUCT_RAD 22
566 #define KLSTRUCT_HUB_TTY 23
567 #define KLSTRUCT_IOC3_TTY 24
569 /* Early Access IO proms are compatible
570 only with KLSTRUCT values upto 24. */
572 #define KLSTRUCT_FIBERCHANNEL 25
573 #define KLSTRUCT_MOD_SERIAL_NUM 26
574 #define KLSTRUCT_IOC3MS 27
575 #define KLSTRUCT_TPU 28
576 #define KLSTRUCT_GSN_A 29
577 #define KLSTRUCT_GSN_B 30
578 #define KLSTRUCT_XTHD 31
579 #define KLSTRUCT_QLFIBRE 32
580 #define KLSTRUCT_1394 33
581 #define KLSTRUCT_USB 34
582 #define KLSTRUCT_USBKBD 35
583 #define KLSTRUCT_USBMS 36
584 #define KLSTRUCT_SCSI_CTLR 37
585 #define KLSTRUCT_PEBRICK 38
586 #define KLSTRUCT_GIGE 39
587 #define KLSTRUCT_IDE 40
590 * These are the indices of various components within a lboard structure.
593 #define IP27_CPU0_INDEX 0
594 #define IP27_CPU1_INDEX 1
595 #define IP27_HUB_INDEX 2
596 #define IP27_MEM_INDEX 3
598 #define BASEIO_BRIDGE_INDEX 0
599 #define BASEIO_IOC3_INDEX 1
600 #define BASEIO_SCSI1_INDEX 2
601 #define BASEIO_SCSI2_INDEX 3
603 #define MIDPLANE_XBOW_INDEX 0
604 #define ROUTER_COMPONENT_INDEX 0
606 #define CH4SCSI_BRIDGE_INDEX 0
608 /* Info holders for various hardware components */
616 typedef u64 *graphics_t;
617 typedef u64 *router_t;
620 * The port info in ip27_cfg area translates to a lboart_t in the
621 * KLCONFIG area. But since KLCONFIG does not use pointers, lboart_t
622 * is stored in terms of a nasid and a offset from start of KLCONFIG
623 * area on that nasid.
625 typedef struct klport_s {
627 unsigned char port_flag;
628 klconf_off_t port_offset;
629 #ifdef CONFIG_IA64_SGI_SN2
634 typedef struct klcpu_s { /* CPU */
636 unsigned short cpu_prid; /* Processor PRID value */
637 unsigned short cpu_fpirr; /* FPU IRR value */
638 unsigned short cpu_speed; /* Speed in MHZ */
639 unsigned short cpu_scachesz; /* secondary cache size in MB */
640 unsigned short cpu_scachespeed;/* secondary cache speed in MHz */
641 #ifdef CONFIG_IA64_SGI_SN2
646 #define CPU_STRUCT_VERSION 2
648 typedef struct klhub_s { /* HUB */
650 uint hub_flags; /* PCFG_HUB_xxx flags */
651 #ifdef CONFIG_IA64_SGI_SN2
652 #define MAX_NI_PORTS 2
653 klport_t hub_port[MAX_NI_PORTS + 1];/* hub is connected to this */
655 klport_t hub_port; /* hub is connected to this */
657 nic_t hub_box_nic; /* nic of containing box */
658 klconf_off_t hub_mfg_nic; /* MFG NIC string */
659 u64 hub_speed; /* Speed of hub in HZ */
660 #ifdef CONFIG_IA64_SGI_SN2
661 moduleid_t hub_io_module; /* attached io module */
666 typedef struct klhub_uart_s { /* HUB */
667 klinfo_t hubuart_info;
668 uint hubuart_flags; /* PCFG_HUB_xxx flags */
669 nic_t hubuart_box_nic; /* nic of containing box */
670 #ifdef CONFIG_IA64_SGI_SN2
675 #define MEMORY_STRUCT_VERSION 2
677 typedef struct klmembnk_s { /* MEMORY BANK */
678 klinfo_t membnk_info;
679 short membnk_memsz; /* Total memory in megabytes */
680 short membnk_dimm_select; /* bank to physical addr mapping*/
681 short membnk_bnksz[MD_MEM_BANKS]; /* Memory bank sizes */
683 #ifdef CONFIG_IA64_SGI_SN2
688 #define KLCONFIG_MEMBNK_SIZE(_info, _bank) \
689 ((_info)->membnk_bnksz[(_bank)])
692 #define MEMBNK_PREMIUM 1
693 #define KLCONFIG_MEMBNK_PREMIUM(_info, _bank) \
694 ((_info)->membnk_attr & (MEMBNK_PREMIUM << (_bank)))
696 #define MAX_SERIAL_NUM_SIZE 10
698 typedef struct klmod_serial_num_s {
701 char snum_str[MAX_SERIAL_NUM_SIZE];
702 unsigned long long snum_int;
704 #ifdef CONFIG_IA64_SGI_SN2
707 } klmod_serial_num_t;
709 /* Macros needed to access serial number structure in lboard_t.
710 Hard coded values are necessary since we cannot treat
711 serial number struct as a component without losing compatibility
712 between prom versions. */
714 #define GET_SNUM_COMP(_l) ((klmod_serial_num_t *)\
715 KLCF_COMP(_l, _l->brd_numcompts))
717 #define MAX_XBOW_LINKS 16
719 typedef struct klxbow_s { /* XBOW */
721 klport_t xbow_port_info[MAX_XBOW_LINKS] ; /* Module number */
722 int xbow_master_hub_link;
723 /* type of brd connected+component struct ptr+flags */
724 #ifdef CONFIG_IA64_SGI_SN2
729 #define MAX_PCI_SLOTS 8
731 typedef struct klpci_device_s {
732 s32 pci_device_id; /* 32 bits of vendor/device ID. */
733 s32 pci_device_pad; /* 32 bits of padding. */
736 #define BRIDGE_STRUCT_VERSION 2
738 typedef struct klbri_s { /* BRIDGE */
740 unsigned char bri_eprominfo ; /* IO6prom connected to bridge */
741 unsigned char bri_bustype ; /* PCI/VME BUS bridge/GIO */
742 pci_t pci_specific ; /* PCI Board config info */
743 klpci_device_t bri_devices[MAX_PCI_DEVS] ; /* PCI IDs */
744 klconf_off_t bri_mfg_nic ;
745 #ifdef CONFIG_IA64_SGI_SN2
750 #define MAX_IOC3_TTY 2
752 typedef struct klioc3_s { /* IOC3 */
754 unsigned char ioc3_ssram ; /* Info about ssram */
755 unsigned char ioc3_nvram ; /* Info about nvram */
756 klinfo_t ioc3_superio ; /* Info about superio */
757 klconf_off_t ioc3_tty_off ;
759 klconf_off_t ioc3_enet_off ;
760 klconf_off_t ioc3_kbd_off ;
761 #ifdef CONFIG_IA64_SGI_SN2
766 #define MAX_VME_SLOTS 8
768 typedef struct klvmeb_s { /* VME BRIDGE - PCI CTLR */
770 vmeb_t vmeb_specific ;
771 klconf_off_t vmeb_brdinfo[MAX_VME_SLOTS] ; /* VME Board config info */
772 #ifdef CONFIG_IA64_SGI_SN2
777 typedef struct klvmed_s { /* VME DEVICE - VME BOARD */
779 vmed_t vmed_specific ;
780 klconf_off_t vmed_brdinfo[MAX_VME_SLOTS] ; /* VME Board config info */
781 #ifdef CONFIG_IA64_SGI_SN2
786 #define ROUTER_VECTOR_VERS 2
788 /* XXX - Don't we need the number of ports here?!? */
789 typedef struct klrou_s { /* ROUTER */
791 uint rou_flags ; /* PCFG_ROUTER_xxx flags */
792 nic_t rou_box_nic ; /* nic of the containing module */
793 klport_t rou_port[MAX_ROUTER_PORTS + 1] ; /* array index 1 to 6 */
794 klconf_off_t rou_mfg_nic ; /* MFG NIC string */
795 u64 rou_vector; /* vector from master node */
796 #ifdef CONFIG_IA64_SGI_SN2
802 * Graphics Controller/Device
804 * (IP27/IO6) Prom versions 6.13 (and 6.5.1 kernels) and earlier
805 * used a couple different structures to store graphics information.
806 * For compatibility reasons, the newer data structure preserves some
807 * of the layout so that fields that are used in the old versions remain
808 * in the same place (with the same info). Determination of what version
809 * of this structure we have is done by checking the cookie field.
811 #define KLGFX_COOKIE 0x0c0de000
813 typedef struct klgfx_s { /* GRAPHICS Device */
815 klconf_off_t old_gndevs; /* for compatibility with older proms */
816 klconf_off_t old_gdoff0; /* for compatibility with older proms */
817 uint cookie; /* for compatibility with older proms */
819 struct klgfx_s *gfx_next_pipe;
820 graphics_t gfx_specific;
821 klconf_off_t pad0; /* for compatibility with older proms */
822 klconf_off_t gfx_mfg_nic;
823 #ifdef CONFIG_IA64_SGI_SN2
828 typedef struct klxthd_s {
830 klconf_off_t xthd_mfg_nic ; /* MFG NIC string */
831 #ifdef CONFIG_IA64_SGI_SN2
836 typedef struct kltpu_s { /* TPU board */
838 klconf_off_t tpu_mfg_nic ; /* MFG NIC string */
839 #ifdef CONFIG_IA64_SGI_SN2
844 typedef struct klgsn_s { /* GSN board */
846 klconf_off_t gsn_mfg_nic ; /* MFG NIC string */
849 #define MAX_SCSI_DEVS 16
852 * NOTE: THis is the max sized kl* structure and is used in klmalloc.c
853 * to allocate space of type COMPONENT. Make sure that if the size of
854 * any other component struct becomes more than this, then redefine
855 * that as the size to be klmalloced.
858 typedef struct klscsi_s { /* SCSI Bus */
860 scsi_t scsi_specific ;
861 unsigned char scsi_numdevs ;
862 klconf_off_t scsi_devinfo[MAX_SCSI_DEVS] ;
863 #ifdef CONFIG_IA64_SGI_SN2
868 typedef struct klscctl_s { /* SCSI Controller */
871 uint scsi_buscnt; /* # busses this cntlr */
872 void *scsi_bus[2]; /* Pointer to 2 klscsi_t's */
873 #ifdef CONFIG_IA64_SGI_SN2
878 typedef struct klscdev_s { /* SCSI device */
879 klinfo_t scdev_info ;
880 struct scsidisk_data *scdev_cfg ; /* driver fills up this */
881 #ifdef CONFIG_IA64_SGI_SN2
886 typedef struct klttydev_s { /* TTY device */
887 klinfo_t ttydev_info ;
888 struct terminal_data *ttydev_cfg ; /* driver fills up this */
889 #ifdef CONFIG_IA64_SGI_SN2
894 typedef struct klenetdev_s { /* ENET device */
895 klinfo_t enetdev_info ;
896 struct net_data *enetdev_cfg ; /* driver fills up this */
897 #ifdef CONFIG_IA64_SGI_SN2
902 typedef struct klkbddev_s { /* KBD device */
903 klinfo_t kbddev_info ;
904 struct keyboard_data *kbddev_cfg ; /* driver fills up this */
905 #ifdef CONFIG_IA64_SGI_SN2
910 typedef struct klmsdev_s { /* mouse device */
911 klinfo_t msdev_info ;
913 #ifdef CONFIG_IA64_SGI_SN2
918 #define MAX_FDDI_DEVS 10 /* XXX Is this true */
920 typedef struct klfddi_s { /* FDDI */
922 fddi_t fddi_specific ;
923 klconf_off_t fddi_devinfo[MAX_FDDI_DEVS] ;
924 #ifdef CONFIG_IA64_SGI_SN2
929 typedef struct klmio_s { /* MIO */
932 #ifdef CONFIG_IA64_SGI_SN2
941 typedef struct klusb_s {
942 klinfo_t usb_info; /* controller info */
943 void *usb_bus; /* handle to usb_bus_t */
944 uint64_t usb_controller; /* ptr to controller info */
945 #ifdef CONFIG_IA64_SGI_SN2
950 typedef union klcomp_s {
962 klscctl_t kc_scsi_ctl;
963 klscdev_t kc_scsi_dev;
966 klmod_serial_num_t kc_snum ;
970 typedef union kldev_s { /* for device structure allocation */
971 klscdev_t kc_scsi_dev ;
972 klttydev_t kc_tty_dev ;
973 klenetdev_t kc_enet_dev ;
974 klkbddev_t kc_kbd_dev ;
977 /* Data structure interface routines. TBD */
979 /* Include launch info in this file itself? TBD */
982 * TBD - Can the ARCS and device driver related info also be included in the
983 * KLCONFIG area. On the IO4PROM, prom device driver info is part of cfgnode_t
984 * structure, viz private to the IO4prom.
988 * TBD - Allocation issues.
990 * Do we need to Mark off sepatate heaps for lboard_t, rboard_t, component,
991 * errinfo and allocate from them, or have a single heap and allocate all
992 * structures from it. Debug is easier in the former method since we can
993 * dump all similar structs in one command, but there will be lots of holes,
994 * in memory and max limits are needed for number of structures.
995 * Another way to make it organized, is to have a union of all components
996 * and allocate a aligned chunk of memory greater than the biggest
1005 #define BRI_PER_XBOW 6
1006 #define PCI_PER_BRI 8
1007 #define DEV_PER_PCI 16
1010 /* Virtual dipswitch values (starting from switch "7"): */
1012 #define VDS_NOGFX 0x8000 /* Don't enable gfx and autoboot */
1013 #define VDS_NOMP 0x100 /* Don't start slave processors */
1014 #define VDS_MANUMODE 0x80 /* Manufacturing mode */
1015 #define VDS_NOARB 0x40 /* No bootmaster arbitration */
1016 #define VDS_PODMODE 0x20 /* Go straight to POD mode */
1017 #define VDS_NO_DIAGS 0x10 /* Don't run any diags after BM arb */
1018 #define VDS_DEFAULTS 0x08 /* Use default environment values */
1019 #define VDS_NOMEMCLEAR 0x04 /* Don't run mem cfg code */
1020 #define VDS_2ND_IO4 0x02 /* Boot from the second IO4 */
1021 #define VDS_DEBUG_PROM 0x01 /* Print PROM debugging messages */
1023 /* external declarations of Linux kernel functions. */
1025 extern lboard_t *find_lboard(lboard_t *start, unsigned char type);
1026 extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type);
1027 extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type);
1028 extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int);
1031 extern xwidgetnum_t nodevertex_widgetnum_get(devfs_handle_t node_vtx);
1032 extern devfs_handle_t nodevertex_xbow_peer_get(devfs_handle_t node_vtx);
1033 extern lboard_t *find_gfxpipe(int pipenum);
1034 extern void setup_gfxpipe_link(devfs_handle_t vhdl,int pipenum);
1035 extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class);
1036 #ifdef CONFIG_IA64_SGI_SN2
1037 extern lboard_t *find_lboard_module_class(lboard_t *start, geoid_t geoid,
1038 unsigned char brd_class);
1040 extern lboard_t *find_lboard_module_class(lboard_t *start, moduleid_t mod,
1041 unsigned char brd_class);
1043 extern lboard_t *find_nic_lboard(lboard_t *, nic_t);
1044 extern lboard_t *find_nic_type_lboard(nasid_t, unsigned char, nic_t);
1045 #ifdef CONFIG_IA64_SGI_SN2
1046 extern lboard_t *find_lboard_modslot(lboard_t *start, geoid_t geoid);
1047 extern lboard_t *find_lboard_module(lboard_t *start, geoid_t geoid);
1048 extern lboard_t *get_board_name(nasid_t nasid, geoid_t geoid, slotid_t slot, char *name);
1050 extern lboard_t *find_lboard_modslot(lboard_t *start, moduleid_t mod, slotid_t slot);
1051 extern lboard_t *find_lboard_module(lboard_t *start, moduleid_t mod);
1052 extern lboard_t *get_board_name(nasid_t nasid, moduleid_t mod, slotid_t slot, char *name);
1054 extern int config_find_nic_router(nasid_t, nic_t, lboard_t **, klrou_t**);
1055 extern int config_find_nic_hub(nasid_t, nic_t, lboard_t **, klhub_t**);
1056 extern int config_find_xbow(nasid_t, lboard_t **, klxbow_t**);
1057 extern int update_klcfg_cpuinfo(nasid_t, int);
1058 extern void board_to_path(lboard_t *brd, char *path);
1059 #ifdef CONFIG_IA64_SGI_SN2
1060 extern moduleid_t get_module_id(nasid_t nasid);
1062 extern void nic_name_convert(char *old_name, char *new_name);
1063 extern int module_brds(nasid_t nasid, lboard_t **module_brds, int n);
1064 extern lboard_t *brd_from_key(uint64_t key);
1065 extern void device_component_canonical_name_get(lboard_t *,klinfo_t *,
1067 extern int board_serial_number_get(lboard_t *,char *);
1068 extern nasid_t get_actual_nasid(lboard_t *brd) ;
1069 extern net_vec_t klcfg_discover_route(lboard_t *, lboard_t *, int);
1071 #endif /* _ASM_IA64_SN_KLCONFIG_H */