source: svn/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/asm/sn/klconfig.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 34.4 KB
Line 
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, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 1999, 2000 by Ralf Baechle
10 */
11#ifndef _ASM_SN_KLCONFIG_H
12#define _ASM_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/*
21 * WARNING:
22 *      Certain assembly language routines (notably xxxxx.s) in the IP27PROM
23 *      will depend on the format of the data structures in this file.  In
24 *      most cases, rearranging the fields can seriously break things.
25 *      Adding fields in the beginning or middle can also break things.
26 *      Add fields if necessary, to the end of a struct in such a way
27 *      that offsets of existing fields do not change.
28 */
29
30#include <linux/types.h>
31#include <asm/sn/types.h>
32
33#if defined(CONFIG_SGI_IP27)
34
35#include <asm/sn/sn0/addrs.h>
36//#include <sys/SN/router.h>
37// XXX Stolen from <sys/SN/router.h>:
38#define MAX_ROUTER_PORTS (6)    /* Max. number of ports on a router */
39#include <asm/sn/sn0/sn0_fru.h>
40//#include <sys/graph.h>
41//#include <sys/xtalk/xbow.h>
42
43#elif defined(CONFIG_SGI_IP35)
44
45#include <asm/sn/sn1/addrs.h>
46#include <sys/sn/router.h>
47#include <sys/graph.h>
48#include <asm/xtalk/xbow.h>
49
50#endif /* !CONFIG_SGI_IP27 && !CONFIG_SGI_IP35 */
51
52#if defined(CONFIG_SGI_IP27) || defined(CONFIG_SGI_IP35)
53#include <asm/sn/agent.h>
54#include <asm/arc/types.h>
55#include <asm/arc/hinv.h>
56#if defined(CONFIG_SGI_IO) || defined(CONFIG_SGI_IP35)
57// The hack file has to be before vector and after sn0_fru....
58#include <asm/hack.h>
59#include <asm/sn/vector.h>
60#include <asm/xtalk/xtalk.h>
61#endif /* CONFIG_SGI_IO || CONFIG_SGI_IP35 */
62#endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */
63
64#define KLCFGINFO_MAGIC 0xbeedbabe
65
66#ifdef FRUTEST
67typedef __u64 klconf_off_t;
68#else
69typedef __s32 klconf_off_t;
70#endif
71
72/*
73 * Some IMPORTANT OFFSETS. These are the offsets on all NODES.
74 */
75#if 0
76#define RAMBASE                 0
77#define ARCSSPB_OFF             0x1000 /* shift it to sys/arcs/spb.h */
78
79#define OFF_HWGRAPH             0
80#endif
81
82#define MAX_MODULE_ID           255
83#define SIZE_PAD                4096 /* 4k padding for structures */
84/*
85 * 1 NODE brd, 2 Router brd (1 8p, 1 meta), 6 Widgets,
86 * 2 Midplanes assuming no pci card cages
87 */
88#define MAX_SLOTS_PER_NODE      (1 + 2 + 6 + 2)
89
90/* XXX if each node is guranteed to have some memory */
91
92#define MAX_PCI_DEVS            8
93
94/* lboard_t->brd_flags fields */
95/* All bits in this field are currently used. Try the pad fields if
96   you need more flag bits */
97
98#define ENABLE_BOARD            0x01
99#define FAILED_BOARD            0x02
100#define DUPLICATE_BOARD         0x04    /* Boards like midplanes/routers which
101                                           are discovered twice. Use one of them */
102#define VISITED_BOARD           0x08    /* Used for compact hub numbering. */
103#define LOCAL_MASTER_IO6        0x10    /* master io6 for that node */
104#define GLOBAL_MASTER_IO6       0x20
105#define THIRD_NIC_PRESENT       0x40    /* for future use */
106#define SECOND_NIC_PRESENT      0x80    /* addons like MIO are present */
107
108/* klinfo->flags fields */
109
110#define KLINFO_ENABLE           0x01    /* This component is enabled */
111#define KLINFO_FAILED           0x02    /* This component failed */
112#define KLINFO_DEVICE           0x04    /* This component is a device */
113#define KLINFO_VISITED          0x08    /* This component has been visited */
114#define KLINFO_CONTROLLER       0x10    /* This component is a device controller */
115#define KLINFO_INSTALL          0x20    /* Install a driver */
116#define KLINFO_HEADLESS         0x40    /* Headless (or hubless) component */
117#define IS_CONSOLE_IOC3(i)      ((((klinfo_t *)i)->flags) & KLINFO_INSTALL)
118
119#define GB2             0x80000000
120
121#define MAX_RSV_PTRS    32
122
123/* Structures to manage various data storage areas */
124/* The numbers must be contiguous since the array index i
125   is used in the code to allocate various areas.
126*/
127
128#define BOARD_STRUCT            0
129#define COMPONENT_STRUCT        1
130#define ERRINFO_STRUCT          2
131#define KLMALLOC_TYPE_MAX       (ERRINFO_STRUCT + 1)
132#define DEVICE_STRUCT           3
133
134
135typedef struct console_s {
136#if defined(CONFIG_SGI_IO)      /* FIXME */
137        __psunsigned_t  uart_base;
138        __psunsigned_t  config_base;
139        __psunsigned_t  memory_base;
140#else
141        unsigned long   uart_base;
142        unsigned long   config_base;
143        unsigned long   memory_base;
144#endif
145        short           baud;
146        short           flag;
147        int             type;
148        nasid_t         nasid;
149        char            wid;
150        char            npci;
151        nic_t           baseio_nic;
152} console_t;
153
154typedef struct klc_malloc_hdr {
155        klconf_off_t km_base;
156        klconf_off_t km_limit;
157        klconf_off_t km_current;
158} klc_malloc_hdr_t;
159
160/* Functions/macros needed to use this structure */
161
162typedef struct kl_config_hdr {
163        __u64           ch_magic;       /* set this to KLCFGINFO_MAGIC */
164        __u32           ch_version;    /* structure version number */
165        klconf_off_t    ch_malloc_hdr_off; /* offset of ch_malloc_hdr */
166        klconf_off_t    ch_cons_off;       /* offset of ch_cons */
167        klconf_off_t    ch_board_info;  /* the link list of boards */
168        console_t       ch_cons_info;   /* address info of the console */
169        klc_malloc_hdr_t ch_malloc_hdr[KLMALLOC_TYPE_MAX];
170        confidence_t    ch_sw_belief;   /* confidence that software is bad*/
171        confidence_t    ch_sn0net_belief; /* confidence that sn0net is bad */
172} kl_config_hdr_t;
173
174
175#define KL_CONFIG_HDR(_nasid)   ((kl_config_hdr_t *)(KLCONFIG_ADDR(_nasid)))
176#if 0
177#define KL_CONFIG_MALLOC_HDR(_nasid) \
178                                (KL_CONFIG_HDR(_nasid)->ch_malloc_hdr)
179#endif
180#define KL_CONFIG_INFO_OFFSET(_nasid)                                   \
181        (KL_CONFIG_HDR(_nasid)->ch_board_info)
182#define KL_CONFIG_INFO_SET_OFFSET(_nasid, _off)                         \
183        (KL_CONFIG_HDR(_nasid)->ch_board_info = (_off))
184
185#define KL_CONFIG_INFO(_nasid)                                          \
186        (lboard_t *)((KL_CONFIG_HDR(_nasid)->ch_board_info) ?           \
187         NODE_OFFSET_TO_K1((_nasid), KL_CONFIG_HDR(_nasid)->ch_board_info) : \
188         0)
189#define KL_CONFIG_MAGIC(_nasid)         (KL_CONFIG_HDR(_nasid)->ch_magic)
190
191#define KL_CONFIG_CHECK_MAGIC(_nasid)                                   \
192        (KL_CONFIG_HDR(_nasid)->ch_magic == KLCFGINFO_MAGIC)
193
194#define KL_CONFIG_HDR_INIT_MAGIC(_nasid)        \
195                  (KL_CONFIG_HDR(_nasid)->ch_magic = KLCFGINFO_MAGIC)
196
197/* --- New Macros for the changed kl_config_hdr_t structure --- */
198
199#if defined(CONFIG_SGI_IO)
200#define PTR_CH_MALLOC_HDR(_k)   ((klc_malloc_hdr_t *)\
201                        ((__psunsigned_t)_k + (_k->ch_malloc_hdr_off)))
202#else
203#define PTR_CH_MALLOC_HDR(_k)   ((klc_malloc_hdr_t *)\
204                        (unsigned long)_k + (_k->ch_malloc_hdr_off)))
205#endif
206
207#define KL_CONFIG_CH_MALLOC_HDR(_n)   PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))
208
209#if defined(CONFIG_SGI_IO)
210#define PTR_CH_CONS_INFO(_k)    ((console_t *)\
211                        ((__psunsigned_t)_k + (_k->ch_cons_off)))
212#else
213#define PTR_CH_CONS_INFO(_k)    ((console_t *)\
214                        ((unsigned long)_k + (_k->ch_cons_off)))
215#endif
216
217#define KL_CONFIG_CH_CONS_INFO(_n)   PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n))
218
219/* ------------------------------------------------------------- */
220
221#define KL_CONFIG_INFO_START(_nasid)    \
222        (klconf_off_t)(KLCONFIG_OFFSET(_nasid) + sizeof(kl_config_hdr_t))
223
224#define KL_CONFIG_BOARD_NASID(_brd)     ((_brd)->brd_nasid)
225#define KL_CONFIG_BOARD_SET_NEXT(_brd, _off)    ((_brd)->brd_next = (_off))
226
227#define KL_CONFIG_DUPLICATE_BOARD(_brd) ((_brd)->brd_flags & DUPLICATE_BOARD)
228
229#define XBOW_PORT_TYPE_HUB(_xbowp, _link)       \
230               ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_HUB)
231#define XBOW_PORT_TYPE_IO(_xbowp, _link)        \
232               ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_IO)
233
234#define XBOW_PORT_IS_ENABLED(_xbowp, _link)     \
235               ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_ENABLE)
236#define XBOW_PORT_NASID(_xbowp, _link)  \
237               ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_nasid)
238
239#define XBOW_PORT_IO     0x1
240#define XBOW_PORT_HUB    0x2
241#define XBOW_PORT_ENABLE 0x4
242
243#define SN0_PORT_FENCE_SHFT     0
244#define SN0_PORT_FENCE_MASK     (1 << SN0_PORT_FENCE_SHFT)
245
246/*
247 * The KLCONFIG area is organized as a LINKED LIST of BOARDs. A BOARD
248 * can be either 'LOCAL' or 'REMOTE'. LOCAL means it is attached to
249 * the LOCAL/current NODE. REMOTE means it is attached to a different
250 * node.(TBD - Need a way to treat ROUTER boards.)
251 *
252 * There are 2 different structures to represent these boards -
253 * lboard - Local board, rboard - remote board. These 2 structures
254 * can be arbitrarily mixed in the LINKED LIST of BOARDs. (Refer
255 * Figure below). The first byte of the rboard or lboard structure
256 * is used to find out its type - no unions are used.
257 * If it is a lboard, then the config info of this board will be found
258 * on the local node. (LOCAL NODE BASE + offset value gives pointer to
259 * the structure.
260 * If it is a rboard, the local structure contains the node number
261 * and the offset of the beginning of the LINKED LIST on the remote node.
262 * The details of the hardware on a remote node can be built locally,
263 * if required, by reading the LINKED LIST on the remote node and
264 * ignoring all the rboards on that node.
265 *
266 * The local node uses the REMOTE NODE NUMBER + OFFSET to point to the
267 * First board info on the remote node. The remote node list is
268 * traversed as the local list, using the REMOTE BASE ADDRESS and not
269 * the local base address and ignoring all rboard values.
270 *
271 *
272 KLCONFIG
273
274 +------------+      +------------+      +------------+      +------------+
275 |  lboard    |  +-->|   lboard   |  +-->|   rboard   |  +-->|   lboard   |
276 +------------+  |   +------------+  |   +------------+  |   +------------+
277 | board info |  |   | board info |  |   |errinfo,bptr|  |   | board info |
278 +------------+  |   +------------+  |   +------------+  |   +------------+
279 | offset     |--+   |  offset    |--+   |  offset    |--+   |offset=NULL |
280 +------------+      +------------+      +------------+      +------------+
281
282
283 +------------+
284 | board info |
285 +------------+       +--------------------------------+
286 | compt 1    |------>| type, rev, diaginfo, size ...  |  (CPU)
287 +------------+       +--------------------------------+
288 | compt 2    |--+
289 +------------+  |    +--------------------------------+
290 |  ...       |  +--->| type, rev, diaginfo, size ...  |  (MEM_BANK)
291 +------------+       +--------------------------------+
292 | errinfo    |--+
293 +------------+  |    +--------------------------------+
294                 +--->|r/l brd errinfo,compt err flags |
295                      +--------------------------------+
296
297 *
298 * Each BOARD consists of COMPONENTs and the BOARD structure has
299 * pointers (offsets) to its COMPONENT structure.
300 * The COMPONENT structure has version info, size and speed info, revision,
301 * error info and the NIC info. This structure can accommodate any
302 * BOARD with arbitrary COMPONENT composition.
303 *
304 * The ERRORINFO part of each BOARD has error information
305 * that describes errors about the BOARD itself. It also has flags to
306 * indicate the COMPONENT(s) on the board that have errors. The error
307 * information specific to the COMPONENT is present in the respective
308 * COMPONENT structure.
309 *
310 * The ERRORINFO structure is also treated like a COMPONENT, ie. the
311 * BOARD has pointers(offset) to the ERRORINFO structure. The rboard
312 * structure also has a pointer to the ERRORINFO structure. This is
313 * the place to store ERRORINFO about a REMOTE NODE, if the HUB on
314 * that NODE is not working or if the REMOTE MEMORY is BAD. In cases where
315 * only the CPU of the REMOTE NODE is disabled, the ERRORINFO pointer can
316 * be a NODE NUMBER, REMOTE OFFSET combination, pointing to error info
317 * which is present on the REMOTE NODE.(TBD)
318 * REMOTE ERRINFO can be stored on any of the nearest nodes
319 * or on all the nearest nodes.(TBD)
320 * Like BOARD structures, REMOTE ERRINFO structures can be built locally
321 * using the rboard errinfo pointer.
322 *
323 * In order to get useful information from this Data organization, a set of
324 * interface routines are provided (TBD). The important thing to remember while
325 * manipulating the structures, is that, the NODE number information should
326 * be used. If the NODE is non-zero (remote) then each offset should
327 * be added to the REMOTE BASE ADDR else it should be added to the LOCAL BASE ADDR.
328 * This includes offsets for BOARDS, COMPONENTS and ERRORINFO.
329 *
330 * Note that these structures do not provide much info about connectivity.
331 * That info will be part of HWGRAPH, which is an extension of the cfg_t
332 * data structure. (ref IP27prom/cfg.h) It has to be extended to include
333 * the IO part of the Network(TBD).
334 *
335 * The data structures below define the above concepts.
336 */
337
338/*
339 * Values for CPU types
340 */
341#define KL_CPU_R4000            0x1     /* Standard R4000 */
342#define KL_CPU_TFP              0x2     /* TFP processor */
343#define KL_CPU_R10000           0x3     /* R10000 (T5) */
344#define KL_CPU_NONE             (-1)    /* no cpu present in slot */
345
346/*
347 * IP27 BOARD classes
348 */
349
350#define KLCLASS_MASK    0xf0
351#define KLCLASS_NONE    0x00
352#define KLCLASS_NODE    0x10             /* CPU, Memory and HUB board */
353#define KLCLASS_CPU     KLCLASS_NODE
354#define KLCLASS_IO      0x20             /* BaseIO, 4 ch SCSI, ethernet, FDDI
355                                            and the non-graphics widget boards */
356#define KLCLASS_ROUTER  0x30             /* Router board */
357#define KLCLASS_MIDPLANE 0x40            /* We need to treat this as a board
358                                            so that we can record error info */
359#define KLCLASS_GFX     0x50            /* graphics boards */
360
361#define KLCLASS_PSEUDO_GFX      0x60    /* HDTV type cards that use a gfx
362                                         * hw ifc to xtalk and are not gfx
363                                         * class for sw purposes */
364
365#define KLCLASS_MAX     7               /* Bump this if a new CLASS is added */
366#define KLTYPE_MAX      10              /* Bump this if a new CLASS is added */
367
368#define KLCLASS_UNKNOWN 0xf0
369
370#define KLCLASS(_x) ((_x) & KLCLASS_MASK)
371
372/*
373 * IP27 board types
374 */
375
376#define KLTYPE_MASK     0x0f
377#define KLTYPE_NONE     0x00
378#define KLTYPE_EMPTY    0x00
379
380#define KLTYPE_WEIRDCPU (KLCLASS_CPU | 0x0)
381#define KLTYPE_IP27     (KLCLASS_CPU | 0x1) /* 2 CPUs(R10K) per board */
382
383#define KLTYPE_WEIRDIO  (KLCLASS_IO  | 0x0)
384#define KLTYPE_BASEIO   (KLCLASS_IO  | 0x1) /* IOC3, SuperIO, Bridge, SCSI */
385#define KLTYPE_IO6      KLTYPE_BASEIO       /* Additional name */
386#define KLTYPE_4CHSCSI  (KLCLASS_IO  | 0x2)
387#define KLTYPE_MSCSI    KLTYPE_4CHSCSI      /* Additional name */
388#define KLTYPE_ETHERNET (KLCLASS_IO  | 0x3)
389#define KLTYPE_MENET    KLTYPE_ETHERNET     /* Additional name */
390#define KLTYPE_FDDI     (KLCLASS_IO  | 0x4)
391#define KLTYPE_UNUSED   (KLCLASS_IO  | 0x5) /* XXX UNUSED */
392#define KLTYPE_HAROLD   (KLCLASS_IO  | 0x6) /* PCI SHOE BOX */
393#define KLTYPE_PCI      KLTYPE_HAROLD
394#define KLTYPE_VME      (KLCLASS_IO  | 0x7) /* Any 3rd party VME card */
395#define KLTYPE_MIO      (KLCLASS_IO  | 0x8)
396#define KLTYPE_FC       (KLCLASS_IO  | 0x9)
397#define KLTYPE_LINC     (KLCLASS_IO  | 0xA)
398#define KLTYPE_TPU      (KLCLASS_IO  | 0xB) /* Tensor Processing Unit */
399#define KLTYPE_GSN_A    (KLCLASS_IO  | 0xC) /* Main GSN board */
400#define KLTYPE_GSN_B    (KLCLASS_IO  | 0xD) /* Auxiliary GSN board */
401
402#define KLTYPE_GFX      (KLCLASS_GFX | 0x0) /* unknown graphics type */
403#define KLTYPE_GFX_KONA (KLCLASS_GFX | 0x1) /* KONA graphics on IP27 */
404#define KLTYPE_GFX_MGRA (KLCLASS_GFX | 0x3) /* MGRAS graphics on IP27 */
405
406#define KLTYPE_WEIRDROUTER (KLCLASS_ROUTER | 0x0)
407#define KLTYPE_ROUTER     (KLCLASS_ROUTER | 0x1)
408#define KLTYPE_ROUTER2    KLTYPE_ROUTER         /* Obsolete! */
409#define KLTYPE_NULL_ROUTER (KLCLASS_ROUTER | 0x2)
410#define KLTYPE_META_ROUTER (KLCLASS_ROUTER | 0x3)
411
412#define KLTYPE_WEIRDMIDPLANE (KLCLASS_MIDPLANE | 0x0)
413#define KLTYPE_MIDPLANE8  (KLCLASS_MIDPLANE | 0x1) /* 8 slot backplane */
414#define KLTYPE_MIDPLANE    KLTYPE_MIDPLANE8
415#define KLTYPE_PBRICK_XBOW      (KLCLASS_MIDPLANE | 0x2)
416
417#define KLTYPE_IOBRICK          (KLCLASS_IOBRICK | 0x0)
418#define KLTYPE_IBRICK           (KLCLASS_IOBRICK | 0x1)
419#define KLTYPE_PBRICK           (KLCLASS_IOBRICK | 0x2)
420#define KLTYPE_XBRICK           (KLCLASS_IOBRICK | 0x3)
421
422#define KLTYPE_PBRICK_BRIDGE    KLTYPE_PBRICK
423
424/* The value of type should be more than 8 so that hinv prints
425 * out the board name from the NIC string. For values less than
426 * 8 the name of the board needs to be hard coded in a few places.
427 * When bringup started nic names had not standardized and so we
428 * had to hard code. (For people interested in history.)
429 */
430#define KLTYPE_XTHD     (KLCLASS_PSEUDO_GFX | 0x9)
431
432#define KLTYPE_UNKNOWN  (KLCLASS_UNKNOWN | 0xf)
433
434#define KLTYPE(_x)      ((_x) & KLTYPE_MASK)
435#define IS_MIO_PRESENT(l)       ((l->brd_type == KLTYPE_BASEIO) && \
436                                 (l->brd_flags & SECOND_NIC_PRESENT))
437#define IS_MIO_IOC3(l,n)        (IS_MIO_PRESENT(l) && (n > 2))
438
439/*
440 * board structures
441 */
442
443#define MAX_COMPTS_PER_BRD 24
444
445#define LOCAL_BOARD 1
446#define REMOTE_BOARD 2
447
448#define LBOARD_STRUCT_VERSION   2
449
450typedef struct lboard_s {
451        klconf_off_t    brd_next;         /* Next BOARD */
452        unsigned char   struct_type;      /* type of structure, local or remote */
453        unsigned char   brd_type;         /* type+class */
454        unsigned char   brd_sversion;     /* version of this structure */
455        unsigned char   brd_brevision;    /* board revision */
456        unsigned char   brd_promver;      /* board prom version, if any */
457        unsigned char   brd_flags;        /* Enabled, Disabled etc */
458        unsigned char   brd_slot;         /* slot number */
459        unsigned short  brd_debugsw;      /* Debug switches */
460        moduleid_t      brd_module;       /* module to which it belongs */
461        partid_t        brd_partition;    /* Partition number */
462        unsigned short  brd_diagval;      /* diagnostic value */
463        unsigned short  brd_diagparm;     /* diagnostic parameter */
464        unsigned char   brd_inventory;    /* inventory history */
465        unsigned char   brd_numcompts;    /* Number of components */
466        nic_t           brd_nic;          /* Number in CAN */
467        nasid_t         brd_nasid;        /* passed parameter */
468        klconf_off_t    brd_compts[MAX_COMPTS_PER_BRD]; /* pointers to COMPONENTS */
469        klconf_off_t    brd_errinfo;      /* Board's error information */
470        struct lboard_s *brd_parent;      /* Logical parent for this brd */
471        vertex_hdl_t    brd_graph_link;   /* vertex hdl to connect extern compts */
472        confidence_t    brd_confidence;   /* confidence that the board is bad */
473        nasid_t         brd_owner;        /* who owns this board */
474        unsigned char   brd_nic_flags;    /* To handle 8 more NICs */
475        char            brd_name[32];
476} lboard_t;
477
478
479/*
480 *      Make sure we pass back the calias space address for local boards.
481 *      klconfig board traversal and error structure extraction defines.
482 */
483
484#define BOARD_SLOT(_brd)        ((_brd)->brd_slot)
485
486#define KLCF_CLASS(_brd)        KLCLASS((_brd)->brd_type)
487#define KLCF_TYPE(_brd)         KLTYPE((_brd)->brd_type)
488#define KLCF_REMOTE(_brd)       (((_brd)->struct_type & LOCAL_BOARD) ? 0 : 1)
489#define KLCF_NUM_COMPS(_brd)    ((_brd)->brd_numcompts)
490#define KLCF_MODULE_ID(_brd)    ((_brd)->brd_module)
491
492#ifdef FRUTEST
493
494#define KLCF_NEXT(_brd)                 ((_brd)->brd_next ? (lboard_t *)((_brd)->brd_next):  NULL)
495#define KLCF_COMP(_brd, _ndx)           (klinfo_t *)((_brd)->brd_compts[(_ndx)])
496#define KLCF_COMP_ERROR(_brd, _comp)    (_brd = _brd , (_comp)->errinfo)
497
498#else
499
500#define KLCF_NEXT(_brd)         \
501        ((_brd)->brd_next ?     \
502         (lboard_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), (_brd)->brd_next)):\
503         NULL)
504#define KLCF_COMP(_brd, _ndx)   \
505                (klinfo_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), \
506                                               (_brd)->brd_compts[(_ndx)]))
507
508#define KLCF_COMP_ERROR(_brd, _comp)    \
509               (NODE_OFFSET_TO_K1(NASID_GET(_brd), (_comp)->errinfo))
510
511#endif
512
513#define KLCF_COMP_TYPE(_comp)   ((_comp)->struct_type)
514#define KLCF_BRIDGE_W_ID(_comp) ((_comp)->physid)       /* Widget ID */
515
516
517
518/*
519 * Generic info structure. This stores common info about a
520 * component.
521 */
522
523typedef struct klinfo_s {                  /* Generic info */
524        unsigned char   struct_type;       /* type of this structure */
525        unsigned char   struct_version;    /* version of this structure */
526        unsigned char   flags;            /* Enabled, disabled etc */
527        unsigned char   revision;         /* component revision */
528        unsigned short  diagval;          /* result of diagnostics */
529        unsigned short  diagparm;         /* diagnostic parameter */
530        unsigned char   inventory;        /* previous inventory status */
531        nic_t           nic;              /* MUst be aligned properly */
532        unsigned char   physid;           /* physical id of component */
533        unsigned int    virtid;           /* virtual id as seen by system */
534        unsigned char   widid;            /* Widget id - if applicable */
535        nasid_t         nasid;            /* node number - from parent */
536        char            pad1;             /* pad out structure. */
537        char            pad2;             /* pad out structure. */
538        COMPONENT       *arcs_compt;      /* ptr to the arcs struct for ease*/
539        klconf_off_t    errinfo;          /* component specific errors */
540        unsigned short  pad3;             /* pci fields have moved over to */
541        unsigned short  pad4;             /* klbri_t */
542} klinfo_t ;
543
544#define KLCONFIG_INFO_ENABLED(_i)       ((_i)->flags & KLINFO_ENABLE)
545/*
546 * Component structures.
547 * Following are the currently identified components:
548 *      CPU, HUB, MEM_BANK,
549 *      XBOW(consists of 16 WIDGETs, each of which can be HUB or GRAPHICS or BRIDGE)
550 *      BRIDGE, IOC3, SuperIO, SCSI, FDDI
551 *      ROUTER
552 *      GRAPHICS
553 */
554#define KLSTRUCT_UNKNOWN        0
555#define KLSTRUCT_CPU            1
556#define KLSTRUCT_HUB            2
557#define KLSTRUCT_MEMBNK         3
558#define KLSTRUCT_XBOW           4
559#define KLSTRUCT_BRI            5
560#define KLSTRUCT_IOC3           6
561#define KLSTRUCT_PCI            7
562#define KLSTRUCT_VME            8
563#define KLSTRUCT_ROU            9
564#define KLSTRUCT_GFX            10
565#define KLSTRUCT_SCSI           11
566#define KLSTRUCT_FDDI           12
567#define KLSTRUCT_MIO            13
568#define KLSTRUCT_DISK           14
569#define KLSTRUCT_TAPE           15
570#define KLSTRUCT_CDROM          16
571#define KLSTRUCT_HUB_UART       17
572#define KLSTRUCT_IOC3ENET       18
573#define KLSTRUCT_IOC3UART       19
574#define KLSTRUCT_UNUSED         20 /* XXX UNUSED */
575#define KLSTRUCT_IOC3PCKM       21
576#define KLSTRUCT_RAD            22
577#define KLSTRUCT_HUB_TTY        23
578#define KLSTRUCT_IOC3_TTY       24
579
580/* Early Access IO proms are compatible
581   only with KLSTRUCT values upto 24. */
582
583#define KLSTRUCT_FIBERCHANNEL   25
584#define KLSTRUCT_MOD_SERIAL_NUM 26
585#define KLSTRUCT_IOC3MS         27
586#define KLSTRUCT_TPU            28
587#define KLSTRUCT_GSN_A          29
588#define KLSTRUCT_GSN_B          30
589#define KLSTRUCT_XTHD           31
590
591/*
592 * These are the indices of various components within a lboard structure.
593 */
594
595#define IP27_CPU0_INDEX 0
596#define IP27_CPU1_INDEX 1
597#define IP27_HUB_INDEX 2
598#define IP27_MEM_INDEX 3
599
600#define BASEIO_BRIDGE_INDEX 0
601#define BASEIO_IOC3_INDEX 1
602#define BASEIO_SCSI1_INDEX 2
603#define BASEIO_SCSI2_INDEX 3
604
605#define MIDPLANE_XBOW_INDEX 0
606#define ROUTER_COMPONENT_INDEX 0
607
608#define CH4SCSI_BRIDGE_INDEX 0
609
610/* Info holders for various hardware components */
611
612typedef __u64 *pci_t;
613typedef __u64 *vmeb_t;
614typedef __u64 *vmed_t;
615typedef __u64 *fddi_t;
616typedef __u64 *scsi_t;
617typedef __u64 *mio_t;
618typedef __u64 *graphics_t;
619typedef __u64 *router_t;
620
621/*
622 * The port info in ip27_cfg area translates to a lboart_t in the
623 * KLCONFIG area. But since KLCONFIG does not use pointers, lboart_t
624 * is stored in terms of a nasid and a offset from start of KLCONFIG
625 * area  on that nasid.
626 */
627typedef struct klport_s {
628        nasid_t         port_nasid;
629        unsigned char   port_flag;
630        klconf_off_t    port_offset;
631} klport_t;
632
633#if 0
634/*
635 * This is very similar to the klport_s but instead of having a componant
636 * offset it has a board offset.
637 */
638typedef struct klxbow_port_s {
639        nasid_t         port_nasid;
640        unsigned char   port_flag;
641        klconf_off_t    board_offset;
642} klxbow_port_t;
643#endif
644
645typedef struct klcpu_s {                          /* CPU */
646        klinfo_t        cpu_info;
647        unsigned short  cpu_prid;       /* Processor PRID value */
648        unsigned short  cpu_fpirr;      /* FPU IRR value */
649        unsigned short  cpu_speed;      /* Speed in MHZ */
650        unsigned short  cpu_scachesz;   /* secondary cache size in MB */
651        unsigned short  cpu_scachespeed;/* secondary cache speed in MHz */
652} klcpu_t ;
653
654#define CPU_STRUCT_VERSION   2
655
656typedef struct klhub_s {                        /* HUB */
657        klinfo_t        hub_info;
658        uint            hub_flags;              /* PCFG_HUB_xxx flags */
659        klport_t        hub_port;               /* hub is connected to this */
660        nic_t           hub_box_nic;            /* nic of containing box */
661        klconf_off_t    hub_mfg_nic;            /* MFG NIC string */
662        __u64           hub_speed;              /* Speed of hub in HZ */
663} klhub_t ;
664
665typedef struct klhub_uart_s {                   /* HUB */
666        klinfo_t        hubuart_info;
667        uint            hubuart_flags;          /* PCFG_HUB_xxx flags */
668        nic_t           hubuart_box_nic;        /* nic of containing box */
669} klhub_uart_t ;
670
671#define MEMORY_STRUCT_VERSION   2
672
673typedef struct klmembnk_s {                     /* MEMORY BANK */
674        klinfo_t        membnk_info;
675        short           membnk_memsz;           /* Total memory in megabytes */
676        short           membnk_dimm_select; /* bank to physical addr mapping*/
677        short           membnk_bnksz[MD_MEM_BANKS]; /* Memory bank sizes */
678        short           membnk_attr;
679} klmembnk_t ;
680
681#define KLCONFIG_MEMBNK_SIZE(_info, _bank)      \
682                            ((_info)->membnk_bnksz[(_bank)])
683
684
685#define MEMBNK_PREMIUM 1
686#define KLCONFIG_MEMBNK_PREMIUM(_info, _bank)   \
687                            ((_info)->membnk_attr & (MEMBNK_PREMIUM << (_bank)))
688
689#define MAX_SERIAL_NUM_SIZE 10
690
691typedef struct klmod_serial_num_s {
692      klinfo_t        snum_info;
693      union {
694              char snum_str[MAX_SERIAL_NUM_SIZE];
695              unsigned long long       snum_int;
696      } snum;
697} klmod_serial_num_t;
698
699/* Macros needed to access serial number structure in lboard_t.
700   Hard coded values are necessary since we cannot treat
701   serial number struct as a component without losing compatibility
702   between prom versions. */
703
704#define GET_SNUM_COMP(_l)       ((klmod_serial_num_t *)\
705                                KLCF_COMP(_l, _l->brd_numcompts))
706
707#define MAX_XBOW_LINKS 16
708
709typedef struct klxbow_s {                          /* XBOW */
710        klinfo_t        xbow_info ;
711        klport_t        xbow_port_info[MAX_XBOW_LINKS] ; /* Module number */
712        int             xbow_master_hub_link;
713        /* type of brd connected+component struct ptr+flags */
714} klxbow_t ;
715
716#define MAX_PCI_SLOTS 8
717
718typedef struct klpci_device_s {
719        __s32   pci_device_id;  /* 32 bits of vendor/device ID. */
720        __s32   pci_device_pad; /* 32 bits of padding. */
721} klpci_device_t;
722
723#define BRIDGE_STRUCT_VERSION   2
724
725typedef struct klbri_s {                          /* BRIDGE */
726        klinfo_t        bri_info ;
727        unsigned char   bri_eprominfo ;    /* IO6prom connected to bridge */
728        unsigned char   bri_bustype ;      /* PCI/VME BUS bridge/GIO */
729        pci_t           pci_specific  ;    /* PCI Board config info */
730        klpci_device_t  bri_devices[MAX_PCI_DEVS] ;     /* PCI IDs */
731        klconf_off_t    bri_mfg_nic ;
732} klbri_t ;
733
734#define MAX_IOC3_TTY    2
735
736typedef struct klioc3_s {                          /* IOC3 */
737        klinfo_t        ioc3_info ;
738        unsigned char   ioc3_ssram ;        /* Info about ssram */
739        unsigned char   ioc3_nvram ;        /* Info about nvram */
740        klinfo_t        ioc3_superio ;      /* Info about superio */
741        klconf_off_t    ioc3_tty_off ;
742        klinfo_t        ioc3_enet ;
743        klconf_off_t    ioc3_enet_off ;
744        klconf_off_t    ioc3_kbd_off ;
745} klioc3_t ;
746
747#define MAX_VME_SLOTS 8
748
749typedef struct klvmeb_s {                          /* VME BRIDGE - PCI CTLR */
750        klinfo_t        vmeb_info ;
751        vmeb_t          vmeb_specific ;
752        klconf_off_t    vmeb_brdinfo[MAX_VME_SLOTS]   ;    /* VME Board config info */
753} klvmeb_t ;
754
755typedef struct klvmed_s {                          /* VME DEVICE - VME BOARD */
756        klinfo_t        vmed_info ;
757        vmed_t          vmed_specific ;
758        klconf_off_t    vmed_brdinfo[MAX_VME_SLOTS]   ;    /* VME Board config info */
759} klvmed_t ;
760
761#define ROUTER_VECTOR_VERS      2
762
763/* XXX - Don't we need the number of ports here?!? */
764typedef struct klrou_s {                          /* ROUTER */
765        klinfo_t        rou_info ;
766        uint            rou_flags ;           /* PCFG_ROUTER_xxx flags */
767        nic_t           rou_box_nic ;         /* nic of the containing module */
768        klport_t        rou_port[MAX_ROUTER_PORTS + 1] ; /* array index 1 to 6 */
769        klconf_off_t    rou_mfg_nic ;     /* MFG NIC string */
770        __u64   rou_vector;       /* vector from master node */
771} klrou_t ;
772
773/*
774 *  Graphics Controller/Device
775 *
776 *  (IP27/IO6) Prom versions 6.13 (and 6.5.1 kernels) and earlier
777 *  used a couple different structures to store graphics information.
778 *  For compatibility reasons, the newer data structure preserves some
779 *  of the layout so that fields that are used in the old versions remain
780 *  in the same place (with the same info).  Determination of what version
781 *  of this structure we have is done by checking the cookie field.
782 */
783#define KLGFX_COOKIE    0x0c0de000
784
785typedef struct klgfx_s {                /* GRAPHICS Device */
786        klinfo_t        gfx_info;
787        klconf_off_t    old_gndevs;     /* for compatibility with older proms */
788        klconf_off_t    old_gdoff0;     /* for compatibility with older proms */
789        uint            cookie;         /* for compatibility with older proms */
790        uint            moduleslot;
791        struct klgfx_s  *gfx_next_pipe;
792        graphics_t      gfx_specific;
793        klconf_off_t    pad0;           /* for compatibility with older proms */
794        klconf_off_t    gfx_mfg_nic;
795} klgfx_t;
796
797typedef struct klxthd_s {
798        klinfo_t        xthd_info ;
799        klconf_off_t    xthd_mfg_nic ;        /* MFG NIC string */
800} klxthd_t ;
801
802typedef struct kltpu_s {                     /* TPU board */
803        klinfo_t        tpu_info ;
804        klconf_off_t    tpu_mfg_nic ;        /* MFG NIC string */
805} kltpu_t ;
806
807typedef struct klgsn_s {                     /* GSN board */
808        klinfo_t        gsn_info ;
809        klconf_off_t    gsn_mfg_nic ;        /* MFG NIC string */
810} klgsn_t ;
811
812#define MAX_SCSI_DEVS 16
813
814/*
815 * NOTE: THis is the max sized kl* structure and is used in klmalloc.c
816 * to allocate space of type COMPONENT. Make sure that if the size of
817 * any other component struct becomes more than this, then redefine
818 * that as the size to be klmalloced.
819 */
820
821typedef struct klscsi_s {                          /* SCSI Controller */
822        klinfo_t        scsi_info ;
823        scsi_t          scsi_specific   ;
824        unsigned char   scsi_numdevs ;
825        klconf_off_t    scsi_devinfo[MAX_SCSI_DEVS] ;
826} klscsi_t ;
827
828typedef struct klscdev_s {                          /* SCSI device */
829        klinfo_t        scdev_info ;
830        struct scsidisk_data *scdev_cfg ; /* driver fills up this */
831} klscdev_t ;
832
833typedef struct klttydev_s {                          /* TTY device */
834        klinfo_t        ttydev_info ;
835        struct terminal_data *ttydev_cfg ; /* driver fills up this */
836} klttydev_t ;
837
838typedef struct klenetdev_s {                          /* ENET device */
839        klinfo_t        enetdev_info ;
840        struct net_data *enetdev_cfg ; /* driver fills up this */
841} klenetdev_t ;
842
843typedef struct klkbddev_s {                          /* KBD device */
844        klinfo_t        kbddev_info ;
845        struct keyboard_data *kbddev_cfg ; /* driver fills up this */
846} klkbddev_t ;
847
848typedef struct klmsdev_s {                          /* mouse device */
849        klinfo_t        msdev_info ;
850        void            *msdev_cfg ;
851} klmsdev_t ;
852
853#define MAX_FDDI_DEVS 10 /* XXX Is this true */
854
855typedef struct klfddi_s {                          /* FDDI */
856        klinfo_t        fddi_info ;
857        fddi_t          fddi_specific ;
858        klconf_off_t    fddi_devinfo[MAX_FDDI_DEVS] ;
859} klfddi_t ;
860
861typedef struct klmio_s {                          /* MIO */
862        klinfo_t        mio_info ;
863        mio_t           mio_specific   ;
864} klmio_t ;
865
866
867typedef union klcomp_s {
868        klcpu_t         kc_cpu;
869        klhub_t         kc_hub;
870        klmembnk_t      kc_mem;
871        klxbow_t        kc_xbow;
872        klbri_t         kc_bri;
873        klioc3_t        kc_ioc3;
874        klvmeb_t        kc_vmeb;
875        klvmed_t        kc_vmed;
876        klrou_t         kc_rou;
877        klgfx_t         kc_gfx;
878        klscsi_t        kc_scsi;
879        klscdev_t       kc_scsi_dev;
880        klfddi_t        kc_fddi;
881        klmio_t         kc_mio;
882        klmod_serial_num_t kc_snum ;
883} klcomp_t;
884
885typedef union kldev_s {      /* for device structure allocation */
886        klscdev_t       kc_scsi_dev ;
887        klttydev_t      kc_tty_dev ;
888        klenetdev_t     kc_enet_dev ;
889        klkbddev_t      kc_kbd_dev ;
890} kldev_t ;
891
892/* Data structure interface routines. TBD */
893
894/* Include launch info in this file itself? TBD */
895
896/*
897 * TBD - Can the ARCS and device driver related info also be included in the
898 * KLCONFIG area. On the IO4PROM, prom device driver info is part of cfgnode_t
899 * structure, viz private to the IO4prom.
900 */
901
902/*
903 * TBD - Allocation issues.
904 *
905 * Do we need to Mark off sepatate heaps for lboard_t, rboard_t, component,
906 * errinfo and allocate from them, or have a single heap and allocate all
907 * structures from it. Debug is easier in the former method since we can
908 * dump all similar structs in one command, but there will be lots of holes,
909 * in memory and max limits are needed for number of structures.
910 * Another way to make it organized, is to have a union of all components
911 * and allocate a aligned chunk of memory greater than the biggest
912 * component.
913 */
914
915typedef union {
916        lboard_t *lbinfo ;
917} biptr_t ;
918
919
920#define BRI_PER_XBOW 6
921#define PCI_PER_BRI  8
922#define DEV_PER_PCI  16
923
924
925/* Virtual dipswitch values (starting from switch "7"): */
926
927#define VDS_NOGFX               0x8000  /* Don't enable gfx and autoboot */
928#define VDS_NOMP                0x100   /* Don't start slave processors */
929#define VDS_MANUMODE            0x80    /* Manufacturing mode */
930#define VDS_NOARB               0x40    /* No bootmaster arbitration */
931#define VDS_PODMODE             0x20    /* Go straight to POD mode */
932#define VDS_NO_DIAGS            0x10    /* Don't run any diags after BM arb */
933#define VDS_DEFAULTS            0x08    /* Use default environment values */
934#define VDS_NOMEMCLEAR          0x04    /* Don't run mem cfg code */
935#define VDS_2ND_IO4             0x02    /* Boot from the second IO4 */
936#define VDS_DEBUG_PROM          0x01    /* Print PROM debugging messages */
937
938/* external declarations of Linux kernel functions. */
939
940extern lboard_t *find_lboard(lboard_t *start, unsigned char type);
941extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type);
942extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type);
943extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int);
944extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class);
945
946
947#if defined(CONFIG_SGI_IO)
948extern xwidgetnum_t nodevertex_widgetnum_get(vertex_hdl_t node_vtx);
949extern vertex_hdl_t nodevertex_xbow_peer_get(vertex_hdl_t node_vtx);
950extern lboard_t *find_gfxpipe(int pipenum);
951extern void setup_gfxpipe_link(vertex_hdl_t vhdl,int pipenum);
952extern lboard_t *find_lboard_module_class(lboard_t *start, moduleid_t mod,
953                                               unsigned char brd_class);
954extern lboard_t *find_nic_lboard(lboard_t *, nic_t);
955extern lboard_t *find_nic_type_lboard(nasid_t, unsigned char, nic_t);
956extern lboard_t *find_lboard_modslot(lboard_t *start, moduleid_t mod, slotid_t slot);
957extern lboard_t *find_lboard_module(lboard_t *start, moduleid_t mod);
958extern lboard_t *get_board_name(nasid_t nasid, moduleid_t mod, slotid_t slot, char *name);
959extern int      config_find_nic_router(nasid_t, nic_t, lboard_t **, klrou_t**);
960extern int      config_find_nic_hub(nasid_t, nic_t, lboard_t **, klhub_t**);
961extern int      config_find_xbow(nasid_t, lboard_t **, klxbow_t**);
962extern klcpu_t *get_cpuinfo(cpuid_t cpu);
963extern int      update_klcfg_cpuinfo(nasid_t, int);
964extern void     board_to_path(lboard_t *brd, char *path);
965extern moduleid_t get_module_id(nasid_t nasid);
966extern void     nic_name_convert(char *old_name, char *new_name);
967extern int      module_brds(nasid_t nasid, lboard_t **module_brds, int n);
968extern lboard_t *brd_from_key(ulong_t key);
969extern void     device_component_canonical_name_get(lboard_t *,klinfo_t *,
970                                                    char *);
971extern int      board_serial_number_get(lboard_t *,char *);
972extern int      is_master_baseio(nasid_t,moduleid_t,slotid_t);
973extern nasid_t  get_actual_nasid(lboard_t *brd) ;
974extern net_vec_t klcfg_discover_route(lboard_t *, lboard_t *, int);
975#else   /* CONFIG_SGI_IO */
976extern klcpu_t *sn_get_cpuinfo(cpuid_t cpu);
977#endif  /* CONFIG_SGI_IO */
978
979#endif /* _ASM_SN_KLCONFIG_H */
Note: See TracBrowser for help on using the repository browser.