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,2001-2004 Silicon Graphics, Inc. All Rights Reserved. |
| 9 | * Copyright (C) 1999 by Ralf Baechle |
| 10 | */ |
| 11 | #ifndef _ASM_IA64_SN_KLCONFIG_H |
| 12 | #define _ASM_IA64_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 | typedef s32 klconf_off_t; |
| 21 | |
| 22 | |
| 23 | /* Functions/macros needed to use this structure */ |
| 24 | |
| 25 | typedef struct kl_config_hdr { |
| 26 | char pad[20]; |
| 27 | klconf_off_t ch_board_info; /* the link list of boards */ |
| 28 | char pad0[88]; |
| 29 | } kl_config_hdr_t; |
| 30 | |
| 31 | |
| 32 | #define NODE_OFFSET_TO_LBOARD(nasid,off) (lboard_t*)(GLOBAL_CAC_ADDR((nasid), (off))) |
| 33 | |
| 34 | /* |
| 35 | * The KLCONFIG area is organized as a LINKED LIST of BOARDs. A BOARD |
| 36 | * can be either 'LOCAL' or 'REMOTE'. LOCAL means it is attached to |
| 37 | * the LOCAL/current NODE. REMOTE means it is attached to a different |
| 38 | * node.(TBD - Need a way to treat ROUTER boards.) |
| 39 | * |
| 40 | * There are 2 different structures to represent these boards - |
| 41 | * lboard - Local board, rboard - remote board. These 2 structures |
| 42 | * can be arbitrarily mixed in the LINKED LIST of BOARDs. (Refer |
| 43 | * Figure below). The first byte of the rboard or lboard structure |
| 44 | * is used to find out its type - no unions are used. |
| 45 | * If it is a lboard, then the config info of this board will be found |
| 46 | * on the local node. (LOCAL NODE BASE + offset value gives pointer to |
| 47 | * the structure. |
| 48 | * If it is a rboard, the local structure contains the node number |
| 49 | * and the offset of the beginning of the LINKED LIST on the remote node. |
| 50 | * The details of the hardware on a remote node can be built locally, |
| 51 | * if required, by reading the LINKED LIST on the remote node and |
| 52 | * ignoring all the rboards on that node. |
| 53 | * |
| 54 | * The local node uses the REMOTE NODE NUMBER + OFFSET to point to the |
| 55 | * First board info on the remote node. The remote node list is |
| 56 | * traversed as the local list, using the REMOTE BASE ADDRESS and not |
| 57 | * the local base address and ignoring all rboard values. |
| 58 | * |
| 59 | * |
| 60 | KLCONFIG |
| 61 | |
| 62 | +------------+ +------------+ +------------+ +------------+ |
| 63 | | lboard | +-->| lboard | +-->| rboard | +-->| lboard | |
| 64 | +------------+ | +------------+ | +------------+ | +------------+ |
| 65 | | board info | | | board info | | |errinfo,bptr| | | board info | |
| 66 | +------------+ | +------------+ | +------------+ | +------------+ |
| 67 | | offset |--+ | offset |--+ | offset |--+ |offset=NULL | |
| 68 | +------------+ +------------+ +------------+ +------------+ |
| 69 | |
| 70 | |
| 71 | +------------+ |
| 72 | | board info | |
| 73 | +------------+ +--------------------------------+ |
| 74 | | compt 1 |------>| type, rev, diaginfo, size ... | (CPU) |
| 75 | +------------+ +--------------------------------+ |
| 76 | | compt 2 |--+ |
| 77 | +------------+ | +--------------------------------+ |
| 78 | | ... | +--->| type, rev, diaginfo, size ... | (MEM_BANK) |
| 79 | +------------+ +--------------------------------+ |
| 80 | | errinfo |--+ |
| 81 | +------------+ | +--------------------------------+ |
| 82 | +--->|r/l brd errinfo,compt err flags | |
| 83 | +--------------------------------+ |
| 84 | |
| 85 | * |
| 86 | * Each BOARD consists of COMPONENTs and the BOARD structure has |
| 87 | * pointers (offsets) to its COMPONENT structure. |
| 88 | * The COMPONENT structure has version info, size and speed info, revision, |
| 89 | * error info and the NIC info. This structure can accommodate any |
| 90 | * BOARD with arbitrary COMPONENT composition. |
| 91 | * |
| 92 | * The ERRORINFO part of each BOARD has error information |
| 93 | * that describes errors about the BOARD itself. It also has flags to |
| 94 | * indicate the COMPONENT(s) on the board that have errors. The error |
| 95 | * information specific to the COMPONENT is present in the respective |
| 96 | * COMPONENT structure. |
| 97 | * |
| 98 | * The ERRORINFO structure is also treated like a COMPONENT, ie. the |
| 99 | * BOARD has pointers(offset) to the ERRORINFO structure. The rboard |
| 100 | * structure also has a pointer to the ERRORINFO structure. This is |
| 101 | * the place to store ERRORINFO about a REMOTE NODE, if the HUB on |
| 102 | * that NODE is not working or if the REMOTE MEMORY is BAD. In cases where |
| 103 | * only the CPU of the REMOTE NODE is disabled, the ERRORINFO pointer can |
| 104 | * be a NODE NUMBER, REMOTE OFFSET combination, pointing to error info |
| 105 | * which is present on the REMOTE NODE.(TBD) |
| 106 | * REMOTE ERRINFO can be stored on any of the nearest nodes |
| 107 | * or on all the nearest nodes.(TBD) |
| 108 | * Like BOARD structures, REMOTE ERRINFO structures can be built locally |
| 109 | * using the rboard errinfo pointer. |
| 110 | * |
| 111 | * In order to get useful information from this Data organization, a set of |
| 112 | * interface routines are provided (TBD). The important thing to remember while |
| 113 | * manipulating the structures, is that, the NODE number information should |
| 114 | * be used. If the NODE is non-zero (remote) then each offset should |
| 115 | * be added to the REMOTE BASE ADDR else it should be added to the LOCAL BASE ADDR. |
| 116 | * This includes offsets for BOARDS, COMPONENTS and ERRORINFO. |
| 117 | * |
| 118 | * Note that these structures do not provide much info about connectivity. |
| 119 | * That info will be part of HWGRAPH, which is an extension of the cfg_t |
| 120 | * data structure. (ref IP27prom/cfg.h) It has to be extended to include |
| 121 | * the IO part of the Network(TBD). |
| 122 | * |
| 123 | * The data structures below define the above concepts. |
| 124 | */ |
| 125 | |
| 126 | |
| 127 | /* |
| 128 | * BOARD classes |
| 129 | */ |
| 130 | |
| 131 | #define KLCLASS_MASK 0xf0 |
| 132 | #define KLCLASS_NONE 0x00 |
| 133 | #define KLCLASS_NODE 0x10 /* CPU, Memory and HUB board */ |
| 134 | #define KLCLASS_CPU KLCLASS_NODE |
| 135 | #define KLCLASS_IO 0x20 /* BaseIO, 4 ch SCSI, ethernet, FDDI |
| 136 | and the non-graphics widget boards */ |
| 137 | #define KLCLASS_ROUTER 0x30 /* Router board */ |
| 138 | #define KLCLASS_MIDPLANE 0x40 /* We need to treat this as a board |
| 139 | so that we can record error info */ |
| 140 | #define KLCLASS_IOBRICK 0x70 /* IP35 iobrick */ |
| 141 | #define KLCLASS_MAX 8 /* Bump this if a new CLASS is added */ |
| 142 | |
| 143 | #define KLCLASS(_x) ((_x) & KLCLASS_MASK) |
| 144 | |
| 145 | |
| 146 | /* |
| 147 | * board types |
| 148 | */ |
| 149 | |
| 150 | #define KLTYPE_MASK 0x0f |
| 151 | #define KLTYPE(_x) ((_x) & KLTYPE_MASK) |
| 152 | |
| 153 | #define KLTYPE_SNIA (KLCLASS_CPU | 0x1) |
| 154 | #define KLTYPE_TIO (KLCLASS_CPU | 0x2) |
| 155 | |
| 156 | #define KLTYPE_ROUTER (KLCLASS_ROUTER | 0x1) |
| 157 | #define KLTYPE_META_ROUTER (KLCLASS_ROUTER | 0x3) |
| 158 | #define KLTYPE_REPEATER_ROUTER (KLCLASS_ROUTER | 0x4) |
| 159 | |
| 160 | #define KLTYPE_IOBRICK_XBOW (KLCLASS_MIDPLANE | 0x2) |
| 161 | |
| 162 | #define KLTYPE_IOBRICK (KLCLASS_IOBRICK | 0x0) |
| 163 | #define KLTYPE_NBRICK (KLCLASS_IOBRICK | 0x4) |
| 164 | #define KLTYPE_PXBRICK (KLCLASS_IOBRICK | 0x6) |
| 165 | #define KLTYPE_IXBRICK (KLCLASS_IOBRICK | 0x7) |
| 166 | #define KLTYPE_CGBRICK (KLCLASS_IOBRICK | 0x8) |
| 167 | #define KLTYPE_OPUSBRICK (KLCLASS_IOBRICK | 0x9) |
| 168 | #define KLTYPE_SABRICK (KLCLASS_IOBRICK | 0xa) |
| 169 | #define KLTYPE_IABRICK (KLCLASS_IOBRICK | 0xb) |
| 170 | #define KLTYPE_PABRICK (KLCLASS_IOBRICK | 0xc) |
| 171 | #define KLTYPE_GABRICK (KLCLASS_IOBRICK | 0xd) |
| 172 | |
| 173 | |
| 174 | /* |
| 175 | * board structures |
| 176 | */ |
| 177 | |
| 178 | #define MAX_COMPTS_PER_BRD 24 |
| 179 | |
| 180 | typedef struct lboard_s { |
| 181 | klconf_off_t brd_next_any; /* Next BOARD */ |
| 182 | unsigned char struct_type; /* type of structure, local or remote */ |
| 183 | unsigned char brd_type; /* type+class */ |
| 184 | unsigned char brd_sversion; /* version of this structure */ |
| 185 | unsigned char brd_brevision; /* board revision */ |
| 186 | unsigned char brd_promver; /* board prom version, if any */ |
| 187 | unsigned char brd_flags; /* Enabled, Disabled etc */ |
| 188 | unsigned char brd_slot; /* slot number */ |
| 189 | unsigned short brd_debugsw; /* Debug switches */ |
| 190 | geoid_t brd_geoid; /* geo id */ |
| 191 | partid_t brd_partition; /* Partition number */ |
| 192 | unsigned short brd_diagval; /* diagnostic value */ |
| 193 | unsigned short brd_diagparm; /* diagnostic parameter */ |
| 194 | unsigned char brd_inventory; /* inventory history */ |
| 195 | unsigned char brd_numcompts; /* Number of components */ |
| 196 | nic_t brd_nic; /* Number in CAN */ |
| 197 | nasid_t brd_nasid; /* passed parameter */ |
| 198 | klconf_off_t brd_compts[MAX_COMPTS_PER_BRD]; /* pointers to COMPONENTS */ |
| 199 | klconf_off_t brd_errinfo; /* Board's error information */ |
| 200 | struct lboard_s *brd_parent; /* Logical parent for this brd */ |
| 201 | char pad0[4]; |
| 202 | unsigned char brd_confidence; /* confidence that the board is bad */ |
| 203 | nasid_t brd_owner; /* who owns this board */ |
| 204 | unsigned char brd_nic_flags; /* To handle 8 more NICs */ |
| 205 | char pad1[24]; /* future expansion */ |
| 206 | char brd_name[32]; |
| 207 | nasid_t brd_next_same_host; /* host of next brd w/same nasid */ |
| 208 | klconf_off_t brd_next_same; /* Next BOARD with same nasid */ |
| 209 | } lboard_t; |
| 210 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | /* |
| 212 | * Generic info structure. This stores common info about a |
| 213 | * component. |
| 214 | */ |
| 215 | |
| 216 | typedef struct klinfo_s { /* Generic info */ |
| 217 | unsigned char struct_type; /* type of this structure */ |
| 218 | unsigned char struct_version; /* version of this structure */ |
| 219 | unsigned char flags; /* Enabled, disabled etc */ |
| 220 | unsigned char revision; /* component revision */ |
| 221 | unsigned short diagval; /* result of diagnostics */ |
| 222 | unsigned short diagparm; /* diagnostic parameter */ |
| 223 | unsigned char inventory; /* previous inventory status */ |
| 224 | unsigned short partid; /* widget part number */ |
| 225 | nic_t nic; /* MUst be aligned properly */ |
| 226 | unsigned char physid; /* physical id of component */ |
| 227 | unsigned int virtid; /* virtual id as seen by system */ |
| 228 | unsigned char widid; /* Widget id - if applicable */ |
| 229 | nasid_t nasid; /* node number - from parent */ |
| 230 | char pad1; /* pad out structure. */ |
| 231 | char pad2; /* pad out structure. */ |
| 232 | void *data; |
| 233 | klconf_off_t errinfo; /* component specific errors */ |
| 234 | unsigned short pad3; /* pci fields have moved over to */ |
| 235 | unsigned short pad4; /* klbri_t */ |
| 236 | } klinfo_t ; |
| 237 | |
| 238 | |
Jack Steiner | 24ee0a6 | 2005-09-12 12:15:43 -0500 | [diff] [blame] | 239 | static inline lboard_t *find_lboard_next(lboard_t * brd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | { |
Jack Steiner | 24ee0a6 | 2005-09-12 12:15:43 -0500 | [diff] [blame] | 241 | if (brd && brd->brd_next_any) |
| 242 | return NODE_OFFSET_TO_LBOARD(NASID_GET(brd), brd->brd_next_any); |
| 243 | return NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | } |
| 245 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | #endif /* _ASM_IA64_SN_KLCONFIG_H */ |