geo.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. * Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved.
  7. */
  8. #ifndef _ASM_IA64_SN_GEO_H
  9. #define _ASM_IA64_SN_GEO_H
  10. /* The geoid_t implementation below is based loosely on the pcfg_t
  11. implementation in sys/SN/promcfg.h. */
  12. /* Type declaractions */
  13. /* Size of a geoid_t structure (must be before decl. of geoid_u) */
  14. #define GEOID_SIZE 8 /* Would 16 be better? The size can
  15. be different on different platforms. */
  16. #define MAX_SLOTS 0xf /* slots per module */
  17. #define MAX_SLABS 0xf /* slabs per slot */
  18. typedef unsigned char geo_type_t;
  19. /* Fields common to all substructures */
  20. typedef struct geo_common_s {
  21. moduleid_t module; /* The module (box) this h/w lives in */
  22. geo_type_t type; /* What type of h/w is named by this geoid_t */
  23. slabid_t slab:4; /* slab (ASIC), 0 .. 15 within slot */
  24. slotid_t slot:4; /* slot (Blade), 0 .. 15 within module */
  25. } geo_common_t;
  26. /* Additional fields for particular types of hardware */
  27. typedef struct geo_node_s {
  28. geo_common_t common; /* No additional fields needed */
  29. } geo_node_t;
  30. typedef struct geo_rtr_s {
  31. geo_common_t common; /* No additional fields needed */
  32. } geo_rtr_t;
  33. typedef struct geo_iocntl_s {
  34. geo_common_t common; /* No additional fields needed */
  35. } geo_iocntl_t;
  36. typedef struct geo_pcicard_s {
  37. geo_iocntl_t common;
  38. char bus; /* Bus/widget number */
  39. char slot; /* PCI slot number */
  40. } geo_pcicard_t;
  41. /* Subcomponents of a node */
  42. typedef struct geo_cpu_s {
  43. geo_node_t node;
  44. char slice; /* Which CPU on the node */
  45. } geo_cpu_t;
  46. typedef struct geo_mem_s {
  47. geo_node_t node;
  48. char membus; /* The memory bus on the node */
  49. char memslot; /* The memory slot on the bus */
  50. } geo_mem_t;
  51. typedef union geoid_u {
  52. geo_common_t common;
  53. geo_node_t node;
  54. geo_iocntl_t iocntl;
  55. geo_pcicard_t pcicard;
  56. geo_rtr_t rtr;
  57. geo_cpu_t cpu;
  58. geo_mem_t mem;
  59. char padsize[GEOID_SIZE];
  60. } geoid_t;
  61. /* Preprocessor macros */
  62. #define GEO_MAX_LEN 48 /* max. formatted length, plus some pad:
  63. module/001c07/slab/5/node/memory/2/slot/4 */
  64. /* Values for geo_type_t */
  65. #define GEO_TYPE_INVALID 0
  66. #define GEO_TYPE_MODULE 1
  67. #define GEO_TYPE_NODE 2
  68. #define GEO_TYPE_RTR 3
  69. #define GEO_TYPE_IOCNTL 4
  70. #define GEO_TYPE_IOCARD 5
  71. #define GEO_TYPE_CPU 6
  72. #define GEO_TYPE_MEM 7
  73. #define GEO_TYPE_MAX (GEO_TYPE_MEM+1)
  74. /* Parameter for hwcfg_format_geoid_compt() */
  75. #define GEO_COMPT_MODULE 1
  76. #define GEO_COMPT_SLAB 2
  77. #define GEO_COMPT_IOBUS 3
  78. #define GEO_COMPT_IOSLOT 4
  79. #define GEO_COMPT_CPU 5
  80. #define GEO_COMPT_MEMBUS 6
  81. #define GEO_COMPT_MEMSLOT 7
  82. #define GEO_INVALID_STR "<invalid>"
  83. #define INVALID_NASID ((nasid_t)-1)
  84. #define INVALID_CNODEID ((cnodeid_t)-1)
  85. #define INVALID_PNODEID ((pnodeid_t)-1)
  86. #define INVALID_SLAB (slabid_t)-1
  87. #define INVALID_SLOT (slotid_t)-1
  88. #define INVALID_MODULE ((moduleid_t)-1)
  89. static inline slabid_t geo_slab(geoid_t g)
  90. {
  91. return (g.common.type == GEO_TYPE_INVALID) ?
  92. INVALID_SLAB : g.common.slab;
  93. }
  94. static inline slotid_t geo_slot(geoid_t g)
  95. {
  96. return (g.common.type == GEO_TYPE_INVALID) ?
  97. INVALID_SLOT : g.common.slot;
  98. }
  99. static inline moduleid_t geo_module(geoid_t g)
  100. {
  101. return (g.common.type == GEO_TYPE_INVALID) ?
  102. INVALID_MODULE : g.common.module;
  103. }
  104. extern geoid_t cnodeid_get_geoid(cnodeid_t cnode);
  105. #endif /* _ASM_IA64_SN_GEO_H */