klconfig.h 10 KB

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