[PATCH] make taskstats sending completely independent of delay accounting on/off...
[usb.git] / include / asm-ia64 / sn / module.h
blob734e980ece2fb43208c168d5ef1a1519a46e4548
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.
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
11 /* parameter for format_module_id() */
12 #define MODULE_FORMAT_BRIEF 1
13 #define MODULE_FORMAT_LONG 2
14 #define MODULE_FORMAT_LCD 3
17 * Module id format
19 * 31-16 Rack ID (encoded class, group, number - 16-bit unsigned int)
20 * 15-8 Brick type (8-bit ascii character)
21 * 7-0 Bay (brick position in rack (0-63) - 8-bit unsigned int)
26 * Macros for getting the brick type
28 #define MODULE_BTYPE_MASK 0xff00
29 #define MODULE_BTYPE_SHFT 8
30 #define MODULE_GET_BTYPE(_m) (((_m) & MODULE_BTYPE_MASK) >> MODULE_BTYPE_SHFT)
31 #define MODULE_BT_TO_CHAR(_b) ((char)(_b))
32 #define MODULE_GET_BTCHAR(_m) (MODULE_BT_TO_CHAR(MODULE_GET_BTYPE(_m)))
35 * Macros for getting the rack ID.
37 #define MODULE_RACK_MASK 0xffff0000
38 #define MODULE_RACK_SHFT 16
39 #define MODULE_GET_RACK(_m) (((_m) & MODULE_RACK_MASK) >> MODULE_RACK_SHFT)
42 * Macros for getting the brick position
44 #define MODULE_BPOS_MASK 0x00ff
45 #define MODULE_BPOS_SHFT 0
46 #define MODULE_GET_BPOS(_m) (((_m) & MODULE_BPOS_MASK) >> MODULE_BPOS_SHFT)
49 * Macros for encoding and decoding rack IDs
50 * A rack number consists of three parts:
51 * class (0==CPU/mixed, 1==I/O), group, number
53 * Rack number is stored just as it is displayed on the screen:
54 * a 3-decimal-digit number.
56 #define RACK_CLASS_DVDR 100
57 #define RACK_GROUP_DVDR 10
58 #define RACK_NUM_DVDR 1
60 #define RACK_CREATE_RACKID(_c, _g, _n) ((_c) * RACK_CLASS_DVDR + \
61 (_g) * RACK_GROUP_DVDR + (_n) * RACK_NUM_DVDR)
63 #define RACK_GET_CLASS(_r) ((_r) / RACK_CLASS_DVDR)
64 #define RACK_GET_GROUP(_r) (((_r) - RACK_GET_CLASS(_r) * \
65 RACK_CLASS_DVDR) / RACK_GROUP_DVDR)
66 #define RACK_GET_NUM(_r) (((_r) - RACK_GET_CLASS(_r) * \
67 RACK_CLASS_DVDR - RACK_GET_GROUP(_r) * \
68 RACK_GROUP_DVDR) / RACK_NUM_DVDR)
71 * Macros for encoding and decoding rack IDs
72 * A rack number consists of three parts:
73 * class 1 bit, 0==CPU/mixed, 1==I/O
74 * group 2 bits for CPU/mixed, 3 bits for I/O
75 * number 3 bits for CPU/mixed, 2 bits for I/O (1 based)
77 #define RACK_GROUP_BITS(_r) (RACK_GET_CLASS(_r) ? 3 : 2)
78 #define RACK_NUM_BITS(_r) (RACK_GET_CLASS(_r) ? 2 : 3)
80 #define RACK_CLASS_MASK(_r) 0x20
81 #define RACK_CLASS_SHFT(_r) 5
82 #define RACK_ADD_CLASS(_r, _c) \
83 ((_r) |= (_c) << RACK_CLASS_SHFT(_r) & RACK_CLASS_MASK(_r))
85 #define RACK_GROUP_SHFT(_r) RACK_NUM_BITS(_r)
86 #define RACK_GROUP_MASK(_r) \
87 ( (((unsigned)1<<RACK_GROUP_BITS(_r)) - 1) << RACK_GROUP_SHFT(_r) )
88 #define RACK_ADD_GROUP(_r, _g) \
89 ((_r) |= (_g) << RACK_GROUP_SHFT(_r) & RACK_GROUP_MASK(_r))
91 #define RACK_NUM_SHFT(_r) 0
92 #define RACK_NUM_MASK(_r) \
93 ( (((unsigned)1<<RACK_NUM_BITS(_r)) - 1) << RACK_NUM_SHFT(_r) )
94 #define RACK_ADD_NUM(_r, _n) \
95 ((_r) |= ((_n) - 1) << RACK_NUM_SHFT(_r) & RACK_NUM_MASK(_r))
99 * Brick type definitions
101 #define MAX_BRICK_TYPES 256 /* brick type is stored as uchar */
103 extern char brick_types[];
105 #define MODULE_CBRICK 0
106 #define MODULE_RBRICK 1
107 #define MODULE_IBRICK 2
108 #define MODULE_KBRICK 3
109 #define MODULE_XBRICK 4
110 #define MODULE_DBRICK 5
111 #define MODULE_PBRICK 6
112 #define MODULE_NBRICK 7
113 #define MODULE_PEBRICK 8
114 #define MODULE_PXBRICK 9
115 #define MODULE_IXBRICK 10
116 #define MODULE_CGBRICK 11
117 #define MODULE_OPUSBRICK 12
118 #define MODULE_SABRICK 13 /* TIO BringUp Brick */
119 #define MODULE_IABRICK 14
120 #define MODULE_PABRICK 15
121 #define MODULE_GABRICK 16
122 #define MODULE_OPUS_TIO 17 /* OPUS TIO Riser */
124 extern char brick_types[];
125 extern void format_module_id(char *, moduleid_t, int);
127 #endif /* _ASM_IA64_SN_MODULE_H */