module.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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-2004 Silicon Graphics, Inc. All rights reserved.
  7. */
  8. #ifndef _ASM_IA64_SN_MODULE_H
  9. #define _ASM_IA64_SN_MODULE_H
  10. /* parameter for format_module_id() */
  11. #define MODULE_FORMAT_BRIEF 1
  12. #define MODULE_FORMAT_LONG 2
  13. #define MODULE_FORMAT_LCD 3
  14. /*
  15. * Module id format
  16. *
  17. * 31-16 Rack ID (encoded class, group, number - 16-bit unsigned int)
  18. * 15-8 Brick type (8-bit ascii character)
  19. * 7-0 Bay (brick position in rack (0-63) - 8-bit unsigned int)
  20. *
  21. */
  22. /*
  23. * Macros for getting the brick type
  24. */
  25. #define MODULE_BTYPE_MASK 0xff00
  26. #define MODULE_BTYPE_SHFT 8
  27. #define MODULE_GET_BTYPE(_m) (((_m) & MODULE_BTYPE_MASK) >> MODULE_BTYPE_SHFT)
  28. #define MODULE_BT_TO_CHAR(_b) ((char)(_b))
  29. #define MODULE_GET_BTCHAR(_m) (MODULE_BT_TO_CHAR(MODULE_GET_BTYPE(_m)))
  30. /*
  31. * Macros for getting the rack ID.
  32. */
  33. #define MODULE_RACK_MASK 0xffff0000
  34. #define MODULE_RACK_SHFT 16
  35. #define MODULE_GET_RACK(_m) (((_m) & MODULE_RACK_MASK) >> MODULE_RACK_SHFT)
  36. /*
  37. * Macros for getting the brick position
  38. */
  39. #define MODULE_BPOS_MASK 0x00ff
  40. #define MODULE_BPOS_SHFT 0
  41. #define MODULE_GET_BPOS(_m) (((_m) & MODULE_BPOS_MASK) >> MODULE_BPOS_SHFT)
  42. /*
  43. * Macros for encoding and decoding rack IDs
  44. * A rack number consists of three parts:
  45. * class (0==CPU/mixed, 1==I/O), group, number
  46. *
  47. * Rack number is stored just as it is displayed on the screen:
  48. * a 3-decimal-digit number.
  49. */
  50. #define RACK_CLASS_DVDR 100
  51. #define RACK_GROUP_DVDR 10
  52. #define RACK_NUM_DVDR 1
  53. #define RACK_CREATE_RACKID(_c, _g, _n) ((_c) * RACK_CLASS_DVDR + \
  54. (_g) * RACK_GROUP_DVDR + (_n) * RACK_NUM_DVDR)
  55. #define RACK_GET_CLASS(_r) ((_r) / RACK_CLASS_DVDR)
  56. #define RACK_GET_GROUP(_r) (((_r) - RACK_GET_CLASS(_r) * \
  57. RACK_CLASS_DVDR) / RACK_GROUP_DVDR)
  58. #define RACK_GET_NUM(_r) (((_r) - RACK_GET_CLASS(_r) * \
  59. RACK_CLASS_DVDR - RACK_GET_GROUP(_r) * \
  60. RACK_GROUP_DVDR) / RACK_NUM_DVDR)
  61. /*
  62. * Macros for encoding and decoding rack IDs
  63. * A rack number consists of three parts:
  64. * class 1 bit, 0==CPU/mixed, 1==I/O
  65. * group 2 bits for CPU/mixed, 3 bits for I/O
  66. * number 3 bits for CPU/mixed, 2 bits for I/O (1 based)
  67. */
  68. #define RACK_GROUP_BITS(_r) (RACK_GET_CLASS(_r) ? 3 : 2)
  69. #define RACK_NUM_BITS(_r) (RACK_GET_CLASS(_r) ? 2 : 3)
  70. #define RACK_CLASS_MASK(_r) 0x20
  71. #define RACK_CLASS_SHFT(_r) 5
  72. #define RACK_ADD_CLASS(_r, _c) \
  73. ((_r) |= (_c) << RACK_CLASS_SHFT(_r) & RACK_CLASS_MASK(_r))
  74. #define RACK_GROUP_SHFT(_r) RACK_NUM_BITS(_r)
  75. #define RACK_GROUP_MASK(_r) \
  76. ( (((unsigned)1<<RACK_GROUP_BITS(_r)) - 1) << RACK_GROUP_SHFT(_r) )
  77. #define RACK_ADD_GROUP(_r, _g) \
  78. ((_r) |= (_g) << RACK_GROUP_SHFT(_r) & RACK_GROUP_MASK(_r))
  79. #define RACK_NUM_SHFT(_r) 0
  80. #define RACK_NUM_MASK(_r) \
  81. ( (((unsigned)1<<RACK_NUM_BITS(_r)) - 1) << RACK_NUM_SHFT(_r) )
  82. #define RACK_ADD_NUM(_r, _n) \
  83. ((_r) |= ((_n) - 1) << RACK_NUM_SHFT(_r) & RACK_NUM_MASK(_r))
  84. /*
  85. * Brick type definitions
  86. */
  87. #define MAX_BRICK_TYPES 256 /* brick type is stored as uchar */
  88. extern char brick_types[];
  89. #define MODULE_CBRICK 0
  90. #define MODULE_RBRICK 1
  91. #define MODULE_IBRICK 2
  92. #define MODULE_KBRICK 3
  93. #define MODULE_XBRICK 4
  94. #define MODULE_DBRICK 5
  95. #define MODULE_PBRICK 6
  96. #define MODULE_NBRICK 7
  97. #define MODULE_PEBRICK 8
  98. #define MODULE_PXBRICK 9
  99. #define MODULE_IXBRICK 10
  100. #define MODULE_CGBRICK 11
  101. #define MODULE_OPUSBRICK 12
  102. #define MODULE_SABRICK 13 /* TIO BringUp Brick */
  103. #define MODULE_IABRICK 14
  104. #define MODULE_PABRICK 15
  105. #define MODULE_GABRICK 16
  106. #define MODULE_OPUS_TIO 17 /* OPUS TIO Riser */
  107. extern char brick_types[];
  108. extern void format_module_id(char *, moduleid_t, int);
  109. #endif /* _ASM_IA64_SN_MODULE_H */