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
6 * Copyright (C) 1992-1997,2000-2003 Silicon Graphics, Inc. All Rights Reserved.
8 #ifndef _ASM_IA64_SN_XTALK_XWIDGET_H
9 #define _ASM_IA64_SN_XTALK_XWIDGET_H
12 * xwidget.h - generic crosstalk widget header file
16 #include <asm/sn/xtalk/xtalk.h>
18 #include <asm/sn/cdl.h>
19 #endif /* __ASSEMBLY__ */
21 #include <xtalk/xtalk.h>
24 #define WIDGET_ID 0x00
25 #define WIDGET_STATUS 0x08
26 #define WIDGET_ERR_UPPER_ADDR 0x10
27 #define WIDGET_ERR_LOWER_ADDR 0x18
28 #define WIDGET_CONTROL 0x20
29 #define WIDGET_REQ_TIMEOUT 0x28
30 #define WIDGET_INTDEST_UPPER_ADDR 0x30
31 #define WIDGET_INTDEST_LOWER_ADDR 0x38
32 #define WIDGET_ERR_CMD_WORD 0x40
33 #define WIDGET_LLP_CFG 0x48
34 #define WIDGET_TFLUSH 0x50
37 #define WIDGET_REV_NUM 0xf0000000
38 #define WIDGET_PART_NUM 0x0ffff000
39 #define WIDGET_MFG_NUM 0x00000ffe
40 #define WIDGET_REV_NUM_SHFT 28
41 #define WIDGET_PART_NUM_SHFT 12
42 #define WIDGET_MFG_NUM_SHFT 1
44 #define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT)
45 #define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT)
46 #define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT)
47 #define XWIDGET_PART_REV_NUM(widgetid) ((XWIDGET_PART_NUM(widgetid) << 4) | \
48 XWIDGET_REV_NUM(widgetid))
49 #define XWIDGET_PART_REV_NUM_REV(partrev) (partrev & 0xf)
52 #define WIDGET_LLP_REC_CNT 0xff000000
53 #define WIDGET_LLP_TX_CNT 0x00ff0000
54 #define WIDGET_PENDING 0x0000001f
56 /* WIDGET_ERR_UPPER_ADDR */
57 #define WIDGET_ERR_UPPER_ADDR_ONLY 0x0000ffff
60 #define WIDGET_F_BAD_PKT 0x00010000
61 #define WIDGET_LLP_XBAR_CRD 0x0000f000
62 #define WIDGET_LLP_XBAR_CRD_SHFT 12
63 #define WIDGET_CLR_RLLP_CNT 0x00000800
64 #define WIDGET_CLR_TLLP_CNT 0x00000400
65 #define WIDGET_SYS_END 0x00000200
66 #define WIDGET_MAX_TRANS 0x000001f0
67 #define WIDGET_PCI_SPEED 0x00000030
68 #define WIDGET_PCI_SPEED_SHFT 4
69 #define WIDGET_PCI_SPEED_33MHZ 0
70 #define WIDGET_PCI_SPEED_66MHZ 1
71 #define WIDGET_WIDGET_ID 0x0000000f
73 /* WIDGET_INTDEST_UPPER_ADDR */
74 #define WIDGET_INT_VECTOR 0xff000000
75 #define WIDGET_INT_VECTOR_SHFT 24
76 #define WIDGET_TARGET_ID 0x000f0000
77 #define WIDGET_TARGET_ID_SHFT 16
78 #define WIDGET_UPP_ADDR 0x0000ffff
80 /* WIDGET_ERR_CMD_WORD */
81 #define WIDGET_DIDN 0xf0000000
82 #define WIDGET_SIDN 0x0f000000
83 #define WIDGET_PACTYP 0x00f00000
84 #define WIDGET_TNUM 0x000f8000
85 #define WIDGET_COHERENT 0x00004000
86 #define WIDGET_DS 0x00003000
87 #define WIDGET_GBR 0x00000800
88 #define WIDGET_VBPM 0x00000400
89 #define WIDGET_ERROR 0x00000200
90 #define WIDGET_BARRIER 0x00000100
93 #define WIDGET_LLP_MAXRETRY 0x03ff0000
94 #define WIDGET_LLP_MAXRETRY_SHFT 16
95 #define WIDGET_LLP_NULLTIMEOUT 0x0000fc00
96 #define WIDGET_LLP_NULLTIMEOUT_SHFT 10
97 #define WIDGET_LLP_MAXBURST 0x000003ff
98 #define WIDGET_LLP_MAXBURST_SHFT 0
101 * according to the crosstalk spec, only 32-bits access to the widget
102 * configuration registers is allowed. some widgets may allow 64-bits
103 * access but software should not depend on it. registers beyond the
104 * widget target flush register are widget dependent thus will not be
108 typedef uint32_t widgetreg_t;
110 /* widget configuration registers */
111 typedef volatile struct widget_cfg {
113 * we access these through synergy unswizzled space, so the address
114 * gets twiddled (i.e. references to 0x4 actually go to 0x0 and vv.)
115 * That's why we put the register first and filler second.
117 widgetreg_t w_id; /* 0x04 */
118 widgetreg_t w_pad_0; /* 0x00 */
119 widgetreg_t w_status; /* 0x0c */
120 widgetreg_t w_pad_1; /* 0x08 */
121 widgetreg_t w_err_upper_addr; /* 0x14 */
122 widgetreg_t w_pad_2; /* 0x10 */
123 widgetreg_t w_err_lower_addr; /* 0x1c */
124 widgetreg_t w_pad_3; /* 0x18 */
125 widgetreg_t w_control; /* 0x24 */
126 widgetreg_t w_pad_4; /* 0x20 */
127 widgetreg_t w_req_timeout; /* 0x2c */
128 widgetreg_t w_pad_5; /* 0x28 */
129 widgetreg_t w_intdest_upper_addr; /* 0x34 */
130 widgetreg_t w_pad_6; /* 0x30 */
131 widgetreg_t w_intdest_lower_addr; /* 0x3c */
132 widgetreg_t w_pad_7; /* 0x38 */
133 widgetreg_t w_err_cmd_word; /* 0x44 */
134 widgetreg_t w_pad_8; /* 0x40 */
135 widgetreg_t w_llp_cfg; /* 0x4c */
136 widgetreg_t w_pad_9; /* 0x48 */
137 widgetreg_t w_tflush; /* 0x54 */
138 widgetreg_t w_pad_10; /* 0x50 */
142 unsigned int other:8;
144 unsigned int error:1;
150 unsigned int pactyp:4;
160 /* IO widget initialization function */
161 typedef struct xwidget_info_s *xwidget_info_t;
164 * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
166 typedef struct xwidget_hwid_s {
167 xwidget_mfg_num_t mfg_num;
168 xwidget_rev_num_t rev_num;
169 xwidget_part_num_t part_num;
174 * Returns 1 if a driver that handles devices described by hwid1 is able
175 * to manage a device with hardwareid hwid2. NOTE: We don't check rev
178 #define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \
179 (((hwid1)->part_num == (hwid2)->part_num) && \
180 (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
181 ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
182 ((hwid1)->mfg_num == (hwid2)->mfg_num)))
185 /* Generic crosstalk widget initialization interface */
188 extern int xwidget_driver_register(xwidget_part_num_t part_num,
189 xwidget_mfg_num_t mfg_num,
193 extern void xwidget_driver_unregister(char *driver_prefix);
195 extern int xwidget_register(struct xwidget_hwid_s *hwid,
199 xwidgetnum_t targetid);
201 extern int xwidget_unregister(vertex_hdl_t);
203 extern void xwidget_reset(vertex_hdl_t xwidget);
204 extern void xwidget_gfx_reset(vertex_hdl_t xwidget);
205 extern char *xwidget_name_get(vertex_hdl_t xwidget);
207 /* Generic crosstalk widget information access interface */
208 extern xwidget_info_t xwidget_info_chk(vertex_hdl_t widget);
209 extern xwidget_info_t xwidget_info_get(vertex_hdl_t widget);
210 extern void xwidget_info_set(vertex_hdl_t widget, xwidget_info_t widget_info);
211 extern vertex_hdl_t xwidget_info_dev_get(xwidget_info_t xwidget_info);
212 extern xwidgetnum_t xwidget_info_id_get(xwidget_info_t xwidget_info);
213 extern int xwidget_info_type_get(xwidget_info_t xwidget_info);
214 extern int xwidget_info_state_get(xwidget_info_t xwidget_info);
215 extern vertex_hdl_t xwidget_info_master_get(xwidget_info_t xwidget_info);
216 extern xwidgetnum_t xwidget_info_masterid_get(xwidget_info_t xwidget_info);
217 extern xwidget_part_num_t xwidget_info_part_num_get(xwidget_info_t xwidget_info);
218 extern xwidget_rev_num_t xwidget_info_rev_num_get(xwidget_info_t xwidget_info);
219 extern xwidget_mfg_num_t xwidget_info_mfg_num_get(xwidget_info_t xwidget_info);
221 extern xwidgetnum_t hub_widget_id(nasid_t);
226 * TBD: DELETE THIS ENTIRE STRUCTURE! Equivalent is now in
227 * xtalk_private.h: xwidget_info_s
228 * This is just here for now because we still have a lot of
229 * junk referencing it.
230 * However, since nobody looks inside ...
232 typedef struct v_widget_s {
233 unsigned int v_widget_s_is_really_empty;
234 #define v_widget_s_is_really_empty and using this would be a syntax error.
238 #endif /* __ASSEMBLY__ */
240 #endif /* _ASM_IA64_SN_XTALK_XWIDGET_H */