Import changeset
[linux-flexiantxendom0-3.2.10.git] / include / asm-mips64 / xtalk / xwidget.h
1 /* $Id$
2  *
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * xwidget.h - generic crosstalk widget header file, derived from IRIX
8  * <sys/xtalk/xtalkwidget.h>, revision 1.32.
9  *
10  * Copyright (C) 1996, 1999 Silcon Graphics, Inc.
11  * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
12  */
13 #ifndef _ASM_XTALK_XWIDGET_H
14 #define _ASM_XTALK_XWIDGET_H
15
16 #include <linux/types.h>
17 #include <asm/xtalk/xtalk.h>
18
19 #define WIDGET_ID                       0x04
20 #define WIDGET_STATUS                   0x0c
21 #define WIDGET_ERR_UPPER_ADDR           0x14
22 #define WIDGET_ERR_LOWER_ADDR           0x1c
23 #define WIDGET_CONTROL                  0x24
24 #define WIDGET_REQ_TIMEOUT              0x2c
25 #define WIDGET_INTDEST_UPPER_ADDR       0x34
26 #define WIDGET_INTDEST_LOWER_ADDR       0x3c
27 #define WIDGET_ERR_CMD_WORD             0x44
28 #define WIDGET_LLP_CFG                  0x4c
29 #define WIDGET_TFLUSH                   0x54
30
31 /* WIDGET_ID */
32 #define WIDGET_REV_NUM                  0xf0000000
33 #define WIDGET_PART_NUM                 0x0ffff000
34 #define WIDGET_MFG_NUM                  0x00000ffe
35 #define WIDGET_REV_NUM_SHFT             28
36 #define WIDGET_PART_NUM_SHFT            12
37 #define WIDGET_MFG_NUM_SHFT             1
38
39 #define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT)
40 #define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT)
41 #define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT)
42
43 /* WIDGET_STATUS */
44 #define WIDGET_LLP_REC_CNT              0xff000000
45 #define WIDGET_LLP_TX_CNT               0x00ff0000
46 #define WIDGET_PENDING                  0x0000001f
47
48 /* WIDGET_ERR_UPPER_ADDR */
49 #define WIDGET_ERR_UPPER_ADDR_ONLY      0x0000ffff
50
51 /* WIDGET_CONTROL */
52 #define WIDGET_F_BAD_PKT                0x00010000
53 #define WIDGET_LLP_XBAR_CRD             0x0000f000
54 #define WIDGET_LLP_XBAR_CRD_SHFT        12
55 #define WIDGET_CLR_RLLP_CNT             0x00000800
56 #define WIDGET_CLR_TLLP_CNT             0x00000400
57 #define WIDGET_SYS_END                  0x00000200
58 #define WIDGET_MAX_TRANS                0x000001f0
59 #define WIDGET_WIDGET_ID                0x0000000f
60
61 /* WIDGET_INTDEST_UPPER_ADDR */
62 #define WIDGET_INT_VECTOR               0xff000000
63 #define WIDGET_INT_VECTOR_SHFT          24
64 #define WIDGET_TARGET_ID                0x000f0000
65 #define WIDGET_TARGET_ID_SHFT           16
66 #define WIDGET_UPP_ADDR                 0x0000ffff
67
68 /* WIDGET_ERR_CMD_WORD */
69 #define WIDGET_DIDN                     0xf0000000
70 #define WIDGET_SIDN                     0x0f000000
71 #define WIDGET_PACTYP                   0x00f00000
72 #define WIDGET_TNUM                     0x000f8000
73 #define WIDGET_COHERENT                 0x00004000
74 #define WIDGET_DS                       0x00003000
75 #define WIDGET_GBR                      0x00000800
76 #define WIDGET_VBPM                     0x00000400
77 #define WIDGET_ERROR                    0x00000200
78 #define WIDGET_BARRIER                  0x00000100
79
80 /* WIDGET_LLP_CFG */
81 #define WIDGET_LLP_MAXRETRY             0x03ff0000
82 #define WIDGET_LLP_MAXRETRY_SHFT        16
83 #define WIDGET_LLP_NULLTIMEOUT          0x0000fc00
84 #define WIDGET_LLP_NULLTIMEOUT_SHFT     10
85 #define WIDGET_LLP_MAXBURST             0x000003ff
86 #define WIDGET_LLP_MAXBURST_SHFT        0
87
88 /*
89  * according to the crosstalk spec, only 32-bits access to the widget
90  * configuration registers is allowed.  some widgets may allow 64-bits
91  * access but software should not depend on it.  registers beyond the
92  * widget target flush register are widget dependent thus will not be
93  * defined here
94  */
95 #if _LANGUAGE_C
96 typedef u32 widgetreg_t;
97
98 /* widget configuration registers */
99 typedef volatile struct widget_cfg {
100         widgetreg_t             w_pad_0;                /* 0x00 */
101         widgetreg_t             w_id;                   /* 0x04 */
102         widgetreg_t             w_pad_1;                /* 0x08 */
103         widgetreg_t             w_status;               /* 0x0c */
104         widgetreg_t             w_pad_2;                /* 0x10 */
105         widgetreg_t             w_err_upper_addr;       /* 0x14 */
106         widgetreg_t             w_pad_3;                /* 0x18 */
107         widgetreg_t             w_err_lower_addr;       /* 0x1c */
108         widgetreg_t             w_pad_4;                /* 0x20 */
109         widgetreg_t             w_control;              /* 0x24 */
110         widgetreg_t             w_pad_5;                /* 0x28 */
111         widgetreg_t             w_req_timeout;          /* 0x2c */
112         widgetreg_t             w_pad_6;                /* 0x30 */
113         widgetreg_t             w_intdest_upper_addr;   /* 0x34 */
114         widgetreg_t             w_pad_7;                /* 0x38 */
115         widgetreg_t             w_intdest_lower_addr;   /* 0x3c */
116         widgetreg_t             w_pad_8;                /* 0x40 */
117         widgetreg_t             w_err_cmd_word;         /* 0x44 */
118         widgetreg_t             w_pad_9;                /* 0x48 */
119         widgetreg_t             w_llp_cfg;              /* 0x4c */
120         widgetreg_t             w_pad_10;               /* 0x50 */
121         widgetreg_t             w_tflush;               /* 0x54 */
122 } widget_cfg_t;
123
124 typedef struct {
125         unsigned        didn:4;
126         unsigned        sidn:4;
127         unsigned        pactyp:4;
128         unsigned        tnum:5;
129         unsigned        ct:1;
130         unsigned        ds:2;
131         unsigned        gbr:1;
132         unsigned        vbpm:1;
133         unsigned        error:1;
134         unsigned        bo:1;
135         unsigned        other:8;
136 } w_err_cmd_word_f;
137
138 typedef union {
139         widgetreg_t             r;
140         w_err_cmd_word_f        f;
141 } w_err_cmd_word_u;
142
143 typedef struct xwidget_info_s *xwidget_info_t;
144
145 /*
146  * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
147  */
148 typedef struct xwidget_hwid_s {
149         xwidget_part_num_t      part_num;
150         xwidget_rev_num_t       rev_num;
151         xwidget_mfg_num_t       mfg_num;
152 } *xwidget_hwid_t;
153
154
155 /*
156  * Returns 1 if a driver that handles devices described by hwid1 is able
157  * to manage a device with hardwareid hwid2.  NOTE: We don't check rev
158  * numbers at all.
159  */
160 #define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \
161         (((hwid1)->part_num == (hwid2)->part_num) && \
162         (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
163         ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
164         ((hwid1)->mfg_num == (hwid2)->mfg_num)))
165
166 #endif                          /* _LANGUAGE_C */
167
168 #endif /* _ASM_XTALK_XWIDGET_H */