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