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