Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * xwidget.h - generic crosstalk widget header file, derived from IRIX
0007  * <sys/xtalk/xtalkwidget.h>, revision 1.32.
0008  *
0009  * Copyright (C) 1996, 1999 Silcon Graphics, Inc.
0010  * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
0011  */
0012 #ifndef _ASM_XTALK_XWIDGET_H
0013 #define _ASM_XTALK_XWIDGET_H
0014 
0015 #include <linux/types.h>
0016 #include <asm/xtalk/xtalk.h>
0017 
0018 #define WIDGET_ID           0x04
0019 #define WIDGET_STATUS           0x0c
0020 #define WIDGET_ERR_UPPER_ADDR       0x14
0021 #define WIDGET_ERR_LOWER_ADDR       0x1c
0022 #define WIDGET_CONTROL          0x24
0023 #define WIDGET_REQ_TIMEOUT      0x2c
0024 #define WIDGET_INTDEST_UPPER_ADDR   0x34
0025 #define WIDGET_INTDEST_LOWER_ADDR   0x3c
0026 #define WIDGET_ERR_CMD_WORD     0x44
0027 #define WIDGET_LLP_CFG          0x4c
0028 #define WIDGET_TFLUSH           0x54
0029 
0030 /* WIDGET_ID */
0031 #define WIDGET_REV_NUM          0xf0000000
0032 #define WIDGET_PART_NUM         0x0ffff000
0033 #define WIDGET_MFG_NUM          0x00000ffe
0034 #define WIDGET_REV_NUM_SHFT     28
0035 #define WIDGET_PART_NUM_SHFT        12
0036 #define WIDGET_MFG_NUM_SHFT     1
0037 
0038 #define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT)
0039 #define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT)
0040 #define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT)
0041 
0042 /* WIDGET_STATUS */
0043 #define WIDGET_LLP_REC_CNT      0xff000000
0044 #define WIDGET_LLP_TX_CNT       0x00ff0000
0045 #define WIDGET_PENDING          0x0000001f
0046 
0047 /* WIDGET_ERR_UPPER_ADDR */
0048 #define WIDGET_ERR_UPPER_ADDR_ONLY  0x0000ffff
0049 
0050 /* WIDGET_CONTROL */
0051 #define WIDGET_F_BAD_PKT        0x00010000
0052 #define WIDGET_LLP_XBAR_CRD     0x0000f000
0053 #define WIDGET_LLP_XBAR_CRD_SHFT    12
0054 #define WIDGET_CLR_RLLP_CNT     0x00000800
0055 #define WIDGET_CLR_TLLP_CNT     0x00000400
0056 #define WIDGET_SYS_END          0x00000200
0057 #define WIDGET_MAX_TRANS        0x000001f0
0058 #define WIDGET_WIDGET_ID        0x0000000f
0059 
0060 /* WIDGET_INTDEST_UPPER_ADDR */
0061 #define WIDGET_INT_VECTOR       0xff000000
0062 #define WIDGET_INT_VECTOR_SHFT      24
0063 #define WIDGET_TARGET_ID        0x000f0000
0064 #define WIDGET_TARGET_ID_SHFT       16
0065 #define WIDGET_UPP_ADDR         0x0000ffff
0066 
0067 /* WIDGET_ERR_CMD_WORD */
0068 #define WIDGET_DIDN         0xf0000000
0069 #define WIDGET_SIDN         0x0f000000
0070 #define WIDGET_PACTYP           0x00f00000
0071 #define WIDGET_TNUM         0x000f8000
0072 #define WIDGET_COHERENT         0x00004000
0073 #define WIDGET_DS           0x00003000
0074 #define WIDGET_GBR          0x00000800
0075 #define WIDGET_VBPM         0x00000400
0076 #define WIDGET_ERROR            0x00000200
0077 #define WIDGET_BARRIER          0x00000100
0078 
0079 /* WIDGET_LLP_CFG */
0080 #define WIDGET_LLP_MAXRETRY     0x03ff0000
0081 #define WIDGET_LLP_MAXRETRY_SHFT    16
0082 #define WIDGET_LLP_NULLTIMEOUT      0x0000fc00
0083 #define WIDGET_LLP_NULLTIMEOUT_SHFT 10
0084 #define WIDGET_LLP_MAXBURST     0x000003ff
0085 #define WIDGET_LLP_MAXBURST_SHFT    0
0086 
0087 /* Xtalk Widget Device Mfgr Nums */
0088 #define WIDGET_XBOW_MFGR_NUM    0x0      /* IP30 XBow Chip */
0089 #define WIDGET_XXBOW_MFGR_NUM   0x0      /* IP35 Xbow + XBridge Chip */
0090 #define WIDGET_ODYS_MFGR_NUM    0x023    /* Odyssey / VPro GFX */
0091 #define WIDGET_TPU_MFGR_NUM 0x024    /* Tensor Processor Unit */
0092 #define WIDGET_XBRDG_MFGR_NUM   0x024    /* IP35 XBridge Chip */
0093 #define WIDGET_HEART_MFGR_NUM   0x036    /* IP30 HEART Chip */
0094 #define WIDGET_BRIDG_MFGR_NUM   0x036    /* PCI Bridge */
0095 #define WIDGET_HUB_MFGR_NUM 0x036    /* IP27 Hub Chip */
0096 #define WIDGET_BDRCK_MFGR_NUM   0x036    /* IP35 Bedrock Chip */
0097 #define WIDGET_IMPCT_MFGR_NUM   0x2aa    /* HQ4 / Impact GFX */
0098 #define WIDGET_KONA_MFGR_NUM    0x2aa    /* InfiniteReality3 / Kona GFX */
0099 #define WIDGET_NULL_MFGR_NUM    -1       /* NULL */
0100 
0101 /* Xtalk Widget Device Part Nums */
0102 #define WIDGET_XBOW_PART_NUM    0x0000
0103 #define WIDGET_HEART_PART_NUM   0xc001
0104 #define WIDGET_BRIDG_PART_NUM   0xc002
0105 #define WIDGET_IMPCT_PART_NUM   0xc003
0106 #define WIDGET_ODYS_PART_NUM    0xc013
0107 #define WIDGET_HUB_PART_NUM 0xc101
0108 #define WIDGET_KONA_PART_NUM    0xc102
0109 #define WIDGET_BDRCK_PART_NUM   0xc110
0110 #define WIDGET_TPU_PART_NUM 0xc202
0111 #define WIDGET_XXBOW_PART_NUM   0xd000
0112 #define WIDGET_XBRDG_PART_NUM   0xd002
0113 #define WIDGET_NULL_PART_NUM    -1
0114 
0115 /* For Xtalk Widget identification */
0116 struct widget_ident {
0117     u32 mfgr;
0118     u32 part;
0119     char *name;
0120     char *revs[16];
0121 };
0122 
0123 /* Known Xtalk Widgets */
0124 static const struct widget_ident __initconst widget_idents[] = {
0125     {
0126         WIDGET_XBOW_MFGR_NUM,
0127         WIDGET_XBOW_PART_NUM,
0128         "xbow",
0129         {NULL, "1.0", "1.1", "1.2", "1.3", "2.0", NULL},
0130     },
0131     {
0132         WIDGET_HEART_MFGR_NUM,
0133         WIDGET_HEART_PART_NUM,
0134         "heart",
0135         {NULL, "A", "B", "C", "D", "E", "F", NULL},
0136     },
0137     {
0138         WIDGET_BRIDG_MFGR_NUM,
0139         WIDGET_BRIDG_PART_NUM,
0140         "bridge",
0141         {NULL, "A", "B", "C", "D", NULL},
0142     },
0143     {
0144         WIDGET_IMPCT_MFGR_NUM,
0145         WIDGET_IMPCT_PART_NUM,
0146         "impact",
0147         {NULL, "A", "B", NULL},
0148     },
0149     {
0150         WIDGET_ODYS_MFGR_NUM,
0151         WIDGET_ODYS_PART_NUM,
0152         "odyssey",
0153         {NULL, "A", "B", NULL},
0154     },
0155     {
0156         WIDGET_HUB_MFGR_NUM,
0157         WIDGET_HUB_PART_NUM,
0158         "hub",
0159         {NULL, "1.0", "2.0", "2.1", "2.2", "2.3", "2.4", NULL},
0160     },
0161     {
0162         WIDGET_KONA_MFGR_NUM,
0163         WIDGET_KONA_PART_NUM,
0164         "kona",
0165         {NULL},
0166     },
0167     {
0168         WIDGET_BDRCK_MFGR_NUM,
0169         WIDGET_BDRCK_PART_NUM,
0170         "bedrock",
0171         {NULL, "1.0", "1.1", NULL},
0172     },
0173     {
0174         WIDGET_TPU_MFGR_NUM,
0175         WIDGET_TPU_PART_NUM,
0176         "tpu",
0177         {"0", NULL},
0178     },
0179     {
0180         WIDGET_XXBOW_MFGR_NUM,
0181         WIDGET_XXBOW_PART_NUM,
0182         "xxbow",
0183         {NULL, "1.0", "2.0", NULL},
0184     },
0185     {
0186         WIDGET_XBRDG_MFGR_NUM,
0187         WIDGET_XBRDG_PART_NUM,
0188         "xbridge",
0189         {NULL, "A", "B", NULL},
0190     },
0191     {
0192         WIDGET_NULL_MFGR_NUM,
0193         WIDGET_NULL_PART_NUM,
0194         NULL,
0195         {NULL},
0196     }
0197 };
0198 
0199 /*
0200  * according to the crosstalk spec, only 32-bits access to the widget
0201  * configuration registers is allowed.  some widgets may allow 64-bits
0202  * access but software should not depend on it.  registers beyond the
0203  * widget target flush register are widget dependent thus will not be
0204  * defined here
0205  */
0206 #ifndef __ASSEMBLY__
0207 typedef u32 widgetreg_t;
0208 
0209 /* widget configuration registers */
0210 typedef volatile struct widget_cfg {
0211     widgetreg_t     w_pad_0;        /* 0x00 */
0212     widgetreg_t     w_id;           /* 0x04 */
0213     widgetreg_t     w_pad_1;        /* 0x08 */
0214     widgetreg_t     w_status;       /* 0x0c */
0215     widgetreg_t     w_pad_2;        /* 0x10 */
0216     widgetreg_t     w_err_upper_addr;   /* 0x14 */
0217     widgetreg_t     w_pad_3;        /* 0x18 */
0218     widgetreg_t     w_err_lower_addr;   /* 0x1c */
0219     widgetreg_t     w_pad_4;        /* 0x20 */
0220     widgetreg_t     w_control;      /* 0x24 */
0221     widgetreg_t     w_pad_5;        /* 0x28 */
0222     widgetreg_t     w_req_timeout;      /* 0x2c */
0223     widgetreg_t     w_pad_6;        /* 0x30 */
0224     widgetreg_t     w_intdest_upper_addr;   /* 0x34 */
0225     widgetreg_t     w_pad_7;        /* 0x38 */
0226     widgetreg_t     w_intdest_lower_addr;   /* 0x3c */
0227     widgetreg_t     w_pad_8;        /* 0x40 */
0228     widgetreg_t     w_err_cmd_word;     /* 0x44 */
0229     widgetreg_t     w_pad_9;        /* 0x48 */
0230     widgetreg_t     w_llp_cfg;      /* 0x4c */
0231     widgetreg_t     w_pad_10;       /* 0x50 */
0232     widgetreg_t     w_tflush;       /* 0x54 */
0233 } widget_cfg_t;
0234 
0235 typedef struct {
0236     unsigned    didn:4;
0237     unsigned    sidn:4;
0238     unsigned    pactyp:4;
0239     unsigned    tnum:5;
0240     unsigned    ct:1;
0241     unsigned    ds:2;
0242     unsigned    gbr:1;
0243     unsigned    vbpm:1;
0244     unsigned    error:1;
0245     unsigned    bo:1;
0246     unsigned    other:8;
0247 } w_err_cmd_word_f;
0248 
0249 typedef union {
0250     widgetreg_t     r;
0251     w_err_cmd_word_f    f;
0252 } w_err_cmd_word_u;
0253 
0254 typedef struct xwidget_info_s *xwidget_info_t;
0255 
0256 /*
0257  * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
0258  */
0259 typedef struct xwidget_hwid_s {
0260     xwidget_part_num_t  part_num;
0261     xwidget_rev_num_t   rev_num;
0262     xwidget_mfg_num_t   mfg_num;
0263 } *xwidget_hwid_t;
0264 
0265 
0266 /*
0267  * Returns 1 if a driver that handles devices described by hwid1 is able
0268  * to manage a device with hardwareid hwid2.  NOTE: We don't check rev
0269  * numbers at all.
0270  */
0271 #define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \
0272     (((hwid1)->part_num == (hwid2)->part_num) && \
0273     (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
0274     ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
0275     ((hwid1)->mfg_num == (hwid2)->mfg_num)))
0276 
0277 #endif /* !__ASSEMBLY__ */
0278 
0279 #endif /* _ASM_XTALK_XWIDGET_H */