OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-ia64/] [sn/] [xtalk/] [xwidget.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
/* $Id: xwidget.h,v 1.1.1.1 2004-04-15 02:58:09 phoenix Exp $
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
 * Copyright (C) 1992-1997,2000-2003 Silicon Graphics, Inc. All Rights Reserved.
8
 */
9
#ifndef __ASM_SN_XTALK_XWIDGET_H__
10
#define __ASM_SN_XTALK_XWIDGET_H__
11
 
12
/*
13
 * xwidget.h - generic crosstalk widget header file
14
 */
15
 
16
#ifdef __KERNEL__
17
#include <asm/sn/xtalk/xtalk.h>
18
#ifndef __ASSEMBLY__
19
#include <asm/sn/cdl.h>
20
#endif /* __ASSEMBLY__ */
21
#else
22
#include <xtalk/xtalk.h>
23
#endif
24
 
25
#ifdef LITTLE_ENDIAN
26
#define WIDGET_ID                       0x00
27
#define WIDGET_STATUS                   0x08
28
#define WIDGET_ERR_UPPER_ADDR           0x10
29
#define WIDGET_ERR_LOWER_ADDR           0x18
30
#define WIDGET_CONTROL                  0x20
31
#define WIDGET_REQ_TIMEOUT              0x28
32
#define WIDGET_INTDEST_UPPER_ADDR       0x30
33
#define WIDGET_INTDEST_LOWER_ADDR       0x38
34
#define WIDGET_ERR_CMD_WORD             0x40
35
#define WIDGET_LLP_CFG                  0x48
36
#define WIDGET_TFLUSH                   0x50
37
#else   /* !LITTLE_ENDIAN */
38
#define WIDGET_ID                       0x04
39
#define WIDGET_STATUS                   0x0c
40
#define WIDGET_ERR_UPPER_ADDR           0x14
41
#define WIDGET_ERR_LOWER_ADDR           0x1c
42
#define WIDGET_CONTROL                  0x24
43
#define WIDGET_REQ_TIMEOUT              0x2c
44
#define WIDGET_INTDEST_UPPER_ADDR       0x34
45
#define WIDGET_INTDEST_LOWER_ADDR       0x3c
46
#define WIDGET_ERR_CMD_WORD             0x44
47
#define WIDGET_LLP_CFG                  0x4c
48
#define WIDGET_TFLUSH                   0x54
49
#endif
50
 
51
/* WIDGET_ID */
52
#define WIDGET_REV_NUM                  0xf0000000
53
#define WIDGET_PART_NUM                 0x0ffff000
54
#define WIDGET_MFG_NUM                  0x00000ffe
55
#define WIDGET_REV_NUM_SHFT             28
56
#define WIDGET_PART_NUM_SHFT            12
57
#define WIDGET_MFG_NUM_SHFT             1
58
 
59
#define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT)
60
#define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT)
61
#define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT)
62
#define XWIDGET_PART_REV_NUM(widgetid) ((XWIDGET_PART_NUM(widgetid) << 4) | \
63
                                        XWIDGET_REV_NUM(widgetid))
64
#define XWIDGET_PART_REV_NUM_REV(partrev) (partrev & 0xf)
65
 
66
/* WIDGET_STATUS */
67
#define WIDGET_LLP_REC_CNT              0xff000000
68
#define WIDGET_LLP_TX_CNT               0x00ff0000
69
#define WIDGET_PENDING                  0x0000001f
70
 
71
/* WIDGET_ERR_UPPER_ADDR */
72
#define WIDGET_ERR_UPPER_ADDR_ONLY      0x0000ffff
73
 
74
/* WIDGET_CONTROL */
75
#define WIDGET_F_BAD_PKT                0x00010000
76
#define WIDGET_LLP_XBAR_CRD             0x0000f000
77
#define WIDGET_LLP_XBAR_CRD_SHFT        12
78
#define WIDGET_CLR_RLLP_CNT             0x00000800
79
#define WIDGET_CLR_TLLP_CNT             0x00000400
80
#define WIDGET_SYS_END                  0x00000200
81
#define WIDGET_MAX_TRANS                0x000001f0
82
#define WIDGET_PCI_SPEED                0x00000030
83
#define WIDGET_PCI_SPEED_SHFT           4
84
#define WIDGET_PCI_SPEED_33MHZ 0
85
#define WIDGET_PCI_SPEED_66MHZ 1
86
#define WIDGET_WIDGET_ID                0x0000000f
87
 
88
/* WIDGET_INTDEST_UPPER_ADDR */
89
#define WIDGET_INT_VECTOR               0xff000000
90
#define WIDGET_INT_VECTOR_SHFT          24
91
#define WIDGET_TARGET_ID                0x000f0000
92
#define WIDGET_TARGET_ID_SHFT           16
93
#define WIDGET_UPP_ADDR                 0x0000ffff
94
 
95
/* WIDGET_ERR_CMD_WORD */
96
#define WIDGET_DIDN                     0xf0000000
97
#define WIDGET_SIDN                     0x0f000000
98
#define WIDGET_PACTYP                   0x00f00000
99
#define WIDGET_TNUM                     0x000f8000
100
#define WIDGET_COHERENT                 0x00004000
101
#define WIDGET_DS                       0x00003000
102
#define WIDGET_GBR                      0x00000800
103
#define WIDGET_VBPM                     0x00000400
104
#define WIDGET_ERROR                    0x00000200
105
#define WIDGET_BARRIER                  0x00000100
106
 
107
/* WIDGET_LLP_CFG */
108
#define WIDGET_LLP_MAXRETRY             0x03ff0000
109
#define WIDGET_LLP_MAXRETRY_SHFT        16
110
#define WIDGET_LLP_NULLTIMEOUT          0x0000fc00
111
#define WIDGET_LLP_NULLTIMEOUT_SHFT     10
112
#define WIDGET_LLP_MAXBURST             0x000003ff
113
#define WIDGET_LLP_MAXBURST_SHFT        0
114
 
115
/*
116
 * according to the crosstalk spec, only 32-bits access to the widget
117
 * configuration registers is allowed.  some widgets may allow 64-bits
118
 * access but software should not depend on it.  registers beyond the
119
 * widget target flush register are widget dependent thus will not be
120
 * defined here
121
 */
122
#ifndef __ASSEMBLY__
123
typedef uint32_t      widgetreg_t;
124
 
125
/* widget configuration registers */
126
typedef volatile struct widget_cfg {
127
#ifdef LITTLE_ENDIAN
128
/*
129
 * we access these through synergy unswizzled space, so the address
130
 * gets twiddled (i.e. references to 0x4 actually go to 0x0 and vv.)
131
 * That's why we put the register first and filler second.
132
 */
133
    widgetreg_t             w_id;       /* 0x04 */
134
    widgetreg_t             w_pad_0;    /* 0x00 */
135
    widgetreg_t             w_status;   /* 0x0c */
136
    widgetreg_t             w_pad_1;    /* 0x08 */
137
    widgetreg_t             w_err_upper_addr;   /* 0x14 */
138
    widgetreg_t             w_pad_2;    /* 0x10 */
139
    widgetreg_t             w_err_lower_addr;   /* 0x1c */
140
    widgetreg_t             w_pad_3;    /* 0x18 */
141
    widgetreg_t             w_control;  /* 0x24 */
142
    widgetreg_t             w_pad_4;    /* 0x20 */
143
    widgetreg_t             w_req_timeout;      /* 0x2c */
144
    widgetreg_t             w_pad_5;    /* 0x28 */
145
    widgetreg_t             w_intdest_upper_addr;       /* 0x34 */
146
    widgetreg_t             w_pad_6;    /* 0x30 */
147
    widgetreg_t             w_intdest_lower_addr;       /* 0x3c */
148
    widgetreg_t             w_pad_7;    /* 0x38 */
149
    widgetreg_t             w_err_cmd_word;     /* 0x44 */
150
    widgetreg_t             w_pad_8;    /* 0x40 */
151
    widgetreg_t             w_llp_cfg;  /* 0x4c */
152
    widgetreg_t             w_pad_9;    /* 0x48 */
153
    widgetreg_t             w_tflush;   /* 0x54 */
154
    widgetreg_t             w_pad_10;   /* 0x50 */
155
#else
156
    widgetreg_t             w_pad_0;    /* 0x00 */
157
    widgetreg_t             w_id;       /* 0x04 */
158
    widgetreg_t             w_pad_1;    /* 0x08 */
159
    widgetreg_t             w_status;   /* 0x0c */
160
    widgetreg_t             w_pad_2;    /* 0x10 */
161
    widgetreg_t             w_err_upper_addr;   /* 0x14 */
162
    widgetreg_t             w_pad_3;    /* 0x18 */
163
    widgetreg_t             w_err_lower_addr;   /* 0x1c */
164
    widgetreg_t             w_pad_4;    /* 0x20 */
165
    widgetreg_t             w_control;  /* 0x24 */
166
    widgetreg_t             w_pad_5;    /* 0x28 */
167
    widgetreg_t             w_req_timeout;      /* 0x2c */
168
    widgetreg_t             w_pad_6;    /* 0x30 */
169
    widgetreg_t             w_intdest_upper_addr;       /* 0x34 */
170
    widgetreg_t             w_pad_7;    /* 0x38 */
171
    widgetreg_t             w_intdest_lower_addr;       /* 0x3c */
172
    widgetreg_t             w_pad_8;    /* 0x40 */
173
    widgetreg_t             w_err_cmd_word;     /* 0x44 */
174
    widgetreg_t             w_pad_9;    /* 0x48 */
175
    widgetreg_t             w_llp_cfg;  /* 0x4c */
176
    widgetreg_t             w_pad_10;   /* 0x50 */
177
    widgetreg_t             w_tflush;   /* 0x54 */
178
#endif /* LITTLE_ENDIAN */
179
} widget_cfg_t;
180
 
181
#ifdef LITTLE_ENDIAN
182
typedef struct {
183
    unsigned                other:8;
184
    unsigned                bo:1;
185
    unsigned                error:1;
186
    unsigned                vbpm:1;
187
    unsigned                gbr:1;
188
    unsigned                ds:2;
189
    unsigned                ct:1;
190
    unsigned                tnum:5;
191
    unsigned                pactyp:4;
192
    unsigned                sidn:4;
193
    unsigned                didn:4;
194
} w_err_cmd_word_f;
195
#else
196
typedef struct {
197
    unsigned                didn:4;
198
    unsigned                sidn:4;
199
    unsigned                pactyp:4;
200
    unsigned                tnum:5;
201
    unsigned                ct:1;
202
    unsigned                ds:2;
203
    unsigned                gbr:1;
204
    unsigned                vbpm:1;
205
    unsigned                error:1;
206
    unsigned                bo:1;
207
    unsigned                other:8;
208
} w_err_cmd_word_f;
209
#endif
210
 
211
#ifdef LITTLE_ENDIAN
212
typedef union {
213
    w_err_cmd_word_f        f;
214
    widgetreg_t             r;
215
} w_err_cmd_word_u;
216
#else
217
typedef union {
218
    widgetreg_t             r;
219
    w_err_cmd_word_f        f;
220
} w_err_cmd_word_u;
221
#endif
222
 
223
/* IO widget initialization function */
224
typedef struct xwidget_info_s *xwidget_info_t;
225
 
226
/*
227
 * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
228
 */
229
#ifdef LITTLE_ENDIAN
230
typedef struct xwidget_hwid_s {
231
    xwidget_mfg_num_t       mfg_num;
232
    xwidget_rev_num_t       rev_num;
233
    xwidget_part_num_t      part_num;
234
}                      *xwidget_hwid_t;
235
#else
236
typedef struct xwidget_hwid_s {
237
    xwidget_part_num_t      part_num;
238
    xwidget_rev_num_t       rev_num;
239
    xwidget_mfg_num_t       mfg_num;
240
}                      *xwidget_hwid_t;
241
#endif
242
 
243
 
244
/*
245
 * Returns 1 if a driver that handles devices described by hwid1 is able
246
 * to manage a device with hardwareid hwid2.  NOTE: We don't check rev
247
 * numbers at all.
248
 */
249
#define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \
250
        (((hwid1)->part_num == (hwid2)->part_num) && \
251
        (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
252
        ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
253
        ((hwid1)->mfg_num == (hwid2)->mfg_num)))
254
 
255
 
256
/* Generic crosstalk widget initialization interface */
257
#if __KERNEL__
258
 
259
extern int              xwidget_driver_register(xwidget_part_num_t part_num,
260
                                                xwidget_mfg_num_t mfg_num,
261
                                                char *driver_prefix,
262
                                                unsigned flags);
263
 
264
extern void             xwidget_driver_unregister(char *driver_prefix);
265
 
266
extern int              xwidget_register(struct xwidget_hwid_s *hwid,
267
                                         vertex_hdl_t dev,
268
                                         xwidgetnum_t id,
269
                                         vertex_hdl_t master,
270
                                         xwidgetnum_t targetid);
271
 
272
extern int              xwidget_unregister(vertex_hdl_t);
273
 
274
extern void             xwidget_reset(vertex_hdl_t xwidget);
275
extern void             xwidget_gfx_reset(vertex_hdl_t xwidget);
276
extern char             *xwidget_name_get(vertex_hdl_t xwidget);
277
 
278
/* Generic crosstalk widget information access interface */
279
extern xwidget_info_t   xwidget_info_chk(vertex_hdl_t widget);
280
extern xwidget_info_t   xwidget_info_get(vertex_hdl_t widget);
281
extern void             xwidget_info_set(vertex_hdl_t widget, xwidget_info_t widget_info);
282
extern vertex_hdl_t     xwidget_info_dev_get(xwidget_info_t xwidget_info);
283
extern xwidgetnum_t     xwidget_info_id_get(xwidget_info_t xwidget_info);
284
extern int              xwidget_info_type_get(xwidget_info_t xwidget_info);
285
extern int              xwidget_info_state_get(xwidget_info_t xwidget_info);
286
extern vertex_hdl_t     xwidget_info_master_get(xwidget_info_t xwidget_info);
287
extern xwidgetnum_t     xwidget_info_masterid_get(xwidget_info_t xwidget_info);
288
extern xwidget_part_num_t xwidget_info_part_num_get(xwidget_info_t xwidget_info);
289
extern xwidget_rev_num_t xwidget_info_rev_num_get(xwidget_info_t xwidget_info);
290
extern xwidget_mfg_num_t xwidget_info_mfg_num_get(xwidget_info_t xwidget_info);
291
 
292
extern xwidgetnum_t hub_widget_id(nasid_t);
293
 
294
 
295
 
296
/*
297
 * TBD: DELETE THIS ENTIRE STRUCTURE!  Equivalent is now in
298
 * xtalk_private.h: xwidget_info_s
299
 * This is just here for now because we still have a lot of
300
 * junk referencing it.
301
 * However, since nobody looks inside ...
302
 */
303
typedef struct v_widget_s {
304
    unsigned                v_widget_s_is_really_empty;
305
#define v_widget_s_is_really_empty      and using this would be a syntax error.
306
} v_widget_t;
307
#endif                          /* _KERNEL */
308
 
309
#endif                          /* __ASSEMBLY__ */
310
 
311
#endif                          /* __ASM_SN_XTALK_XWIDGET_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.