📄 xbow.h
字号:
/* $Id$ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1992-1997,2000-2003 Silicon Graphics, Inc. All Rights Reserved. */#ifndef _ASM_SN_SN_XTALK_XBOW_H#define _ASM_SN_SN_XTALK_XBOW_H/* * xbow.h - header file for crossbow chip and xbow section of xbridge */#include <linux/config.h>#include <asm/sn/xtalk/xtalk.h>#include <asm/sn/xtalk/xwidget.h>#include <asm/sn/xtalk/xswitch.h>#ifndef __ASSEMBLY__#include <asm/sn/xtalk/xbow_info.h>#endif#define XBOW_DRV_PREFIX "xbow_"/* The crossbow chip supports 8 8/16 bits I/O ports, numbered 0x8 through 0xf. * It also implements the widget 0 address space and register set. */#define XBOW_PORT_0 0x0#define XBOW_PORT_8 0x8#define XBOW_PORT_9 0x9#define XBOW_PORT_A 0xa#define XBOW_PORT_B 0xb#define XBOW_PORT_C 0xc#define XBOW_PORT_D 0xd#define XBOW_PORT_E 0xe#define XBOW_PORT_F 0xf#define MAX_XBOW_PORTS 8 /* number of ports on xbow chip */#define BASE_XBOW_PORT XBOW_PORT_8 /* Lowest external port */#define MAX_PORT_NUM 0x10 /* maximum port number + 1 */#define XBOW_WIDGET_ID 0 /* xbow is itself widget 0 */#define XBOW_HUBLINK_LOW 0xa#define XBOW_HUBLINK_HIGH 0xb#define XBOW_PEER_LINK(link) (link == XBOW_HUBLINK_LOW) ? \ XBOW_HUBLINK_HIGH : XBOW_HUBLINK_LOW#define XBOW_CREDIT 4#define MAX_XBOW_NAME 16#ifndef __ASSEMBLY__typedef uint32_t xbowreg_t;#define XBOWCONST (xbowreg_t)/* Generic xbow register, given base and offset */#define XBOW_REG_PTR(base, offset) ((volatile xbowreg_t*) \ ((__psunsigned_t)(base) + (__psunsigned_t)(offset)))/* Register set for each xbow link */typedef volatile struct xb_linkregs_s {#ifdef LITTLE_ENDIAN/* * we access these through synergy unswizzled space, so the address * gets twiddled (i.e. references to 0x4 actually go to 0x0 and vv.) * That's why we put the register first and filler second. */ xbowreg_t link_ibf; xbowreg_t filler0; /* filler for proper alignment */ xbowreg_t link_control; xbowreg_t filler1; xbowreg_t link_status; xbowreg_t filler2; xbowreg_t link_arb_upper; xbowreg_t filler3; xbowreg_t link_arb_lower; xbowreg_t filler4; xbowreg_t link_status_clr; xbowreg_t filler5; xbowreg_t link_reset; xbowreg_t filler6; xbowreg_t link_aux_status; xbowreg_t filler7;#else xbowreg_t filler0; /* filler for proper alignment */ xbowreg_t link_ibf; xbowreg_t filler1; xbowreg_t link_control; xbowreg_t filler2; xbowreg_t link_status; xbowreg_t filler3; xbowreg_t link_arb_upper; xbowreg_t filler4; xbowreg_t link_arb_lower; xbowreg_t filler5; xbowreg_t link_status_clr; xbowreg_t filler6; xbowreg_t link_reset; xbowreg_t filler7; xbowreg_t link_aux_status;#endif /* LITTLE_ENDIAN */} xb_linkregs_t;typedef volatile struct xbow_s { /* standard widget configuration 0x000000-0x000057 */ widget_cfg_t xb_widget; /* 0x000000 */ /* helper fieldnames for accessing bridge widget */#define xb_wid_id xb_widget.w_id#define xb_wid_stat xb_widget.w_status#define xb_wid_err_upper xb_widget.w_err_upper_addr#define xb_wid_err_lower xb_widget.w_err_lower_addr#define xb_wid_control xb_widget.w_control#define xb_wid_req_timeout xb_widget.w_req_timeout#define xb_wid_int_upper xb_widget.w_intdest_upper_addr#define xb_wid_int_lower xb_widget.w_intdest_lower_addr#define xb_wid_err_cmdword xb_widget.w_err_cmd_word#define xb_wid_llp xb_widget.w_llp_cfg#define xb_wid_stat_clr xb_widget.w_tflush#ifdef LITTLE_ENDIAN/* * we access these through synergy unswizzled space, so the address * gets twiddled (i.e. references to 0x4 actually go to 0x0 and vv.) * That's why we put the register first and filler second. */ /* xbow-specific widget configuration 0x000058-0x0000FF */ xbowreg_t xb_wid_arb_reload; /* 0x00005C */ xbowreg_t _pad_000058; xbowreg_t xb_perf_ctr_a; /* 0x000064 */ xbowreg_t _pad_000060; xbowreg_t xb_perf_ctr_b; /* 0x00006c */ xbowreg_t _pad_000068; xbowreg_t xb_nic; /* 0x000074 */ xbowreg_t _pad_000070; /* Xbridge only */ xbowreg_t xb_w0_rst_fnc; /* 0x00007C */ xbowreg_t _pad_000078; xbowreg_t xb_l8_rst_fnc; /* 0x000084 */ xbowreg_t _pad_000080; xbowreg_t xb_l9_rst_fnc; /* 0x00008c */ xbowreg_t _pad_000088; xbowreg_t xb_la_rst_fnc; /* 0x000094 */ xbowreg_t _pad_000090; xbowreg_t xb_lb_rst_fnc; /* 0x00009c */ xbowreg_t _pad_000098; xbowreg_t xb_lc_rst_fnc; /* 0x0000a4 */ xbowreg_t _pad_0000a0; xbowreg_t xb_ld_rst_fnc; /* 0x0000ac */ xbowreg_t _pad_0000a8; xbowreg_t xb_le_rst_fnc; /* 0x0000b4 */ xbowreg_t _pad_0000b0; xbowreg_t xb_lf_rst_fnc; /* 0x0000bc */ xbowreg_t _pad_0000b8; xbowreg_t xb_lock; /* 0x0000c4 */ xbowreg_t _pad_0000c0; xbowreg_t xb_lock_clr; /* 0x0000cc */ xbowreg_t _pad_0000c8; /* end of Xbridge only */ xbowreg_t _pad_0000d0[12];#else /* xbow-specific widget configuration 0x000058-0x0000FF */ xbowreg_t _pad_000058; xbowreg_t xb_wid_arb_reload; /* 0x00005C */ xbowreg_t _pad_000060; xbowreg_t xb_perf_ctr_a; /* 0x000064 */ xbowreg_t _pad_000068; xbowreg_t xb_perf_ctr_b; /* 0x00006c */ xbowreg_t _pad_000070; xbowreg_t xb_nic; /* 0x000074 */ /* Xbridge only */ xbowreg_t _pad_000078; xbowreg_t xb_w0_rst_fnc; /* 0x00007C */ xbowreg_t _pad_000080; xbowreg_t xb_l8_rst_fnc; /* 0x000084 */ xbowreg_t _pad_000088; xbowreg_t xb_l9_rst_fnc; /* 0x00008c */ xbowreg_t _pad_000090; xbowreg_t xb_la_rst_fnc; /* 0x000094 */ xbowreg_t _pad_000098; xbowreg_t xb_lb_rst_fnc; /* 0x00009c */ xbowreg_t _pad_0000a0; xbowreg_t xb_lc_rst_fnc; /* 0x0000a4 */ xbowreg_t _pad_0000a8; xbowreg_t xb_ld_rst_fnc; /* 0x0000ac */ xbowreg_t _pad_0000b0; xbowreg_t xb_le_rst_fnc; /* 0x0000b4 */ xbowreg_t _pad_0000b8; xbowreg_t xb_lf_rst_fnc; /* 0x0000bc */ xbowreg_t _pad_0000c0; xbowreg_t xb_lock; /* 0x0000c4 */ xbowreg_t _pad_0000c8; xbowreg_t xb_lock_clr; /* 0x0000cc */ /* end of Xbridge only */ xbowreg_t _pad_0000d0[12];#endif /* LITTLE_ENDIAN */ /* Link Specific Registers, port 8..15 0x000100-0x000300 */ xb_linkregs_t xb_link_raw[MAX_XBOW_PORTS];#define xb_link(p) xb_link_raw[(p) & (MAX_XBOW_PORTS - 1)]} xbow_t;/* Configuration structure which describes each xbow link */typedef struct xbow_cfg_s { int xb_port; /* port number (0-15) */ int xb_flags; /* port software flags */ short xb_shift; /* shift for arb reg (mask is 0xff) */ short xb_ul; /* upper or lower arb reg */ int xb_pad; /* use this later (pad to ptr align) */ xb_linkregs_t *xb_linkregs; /* pointer to link registers */ widget_cfg_t *xb_widget; /* pointer to widget registers */ char xb_name[MAX_XBOW_NAME]; /* port name */ xbowreg_t xb_sh_arb_upper; /* shadow upper arb register */ xbowreg_t xb_sh_arb_lower; /* shadow lower arb register */} xbow_cfg_t;#define XB_FLAGS_EXISTS 0x1 /* device exists */#define XB_FLAGS_MASTER 0x2#define XB_FLAGS_SLAVE 0x0#define XB_FLAGS_GBR 0x4#define XB_FLAGS_16BIT 0x8#define XB_FLAGS_8BIT 0x0/* get xbow config information for port p */#define XB_CONFIG(p) xbow_cfg[xb_ports[p]]/* is widget port number valid? (based on version 7.0 of xbow spec) */#define XBOW_WIDGET_IS_VALID(wid) ((wid) >= XBOW_PORT_8 && (wid) <= XBOW_PORT_F)/* whether to use upper or lower arbitration register, given source widget id */#define XBOW_ARB_IS_UPPER(wid) ((wid) >= XBOW_PORT_8 && (wid) <= XBOW_PORT_B)#define XBOW_ARB_IS_LOWER(wid) ((wid) >= XBOW_PORT_C && (wid) <= XBOW_PORT_F)/* offset of arbitration register, given source widget id */#define XBOW_ARB_OFF(wid) (XBOW_ARB_IS_UPPER(wid) ? 0x1c : 0x24)#endif /* __ASSEMBLY__ */#define XBOW_WID_ID WIDGET_ID#define XBOW_WID_STAT WIDGET_STATUS#define XBOW_WID_ERR_UPPER WIDGET_ERR_UPPER_ADDR#define XBOW_WID_ERR_LOWER WIDGET_ERR_LOWER_ADDR#define XBOW_WID_CONTROL WIDGET_CONTROL#define XBOW_WID_REQ_TO WIDGET_REQ_TIMEOUT#define XBOW_WID_INT_UPPER WIDGET_INTDEST_UPPER_ADDR#define XBOW_WID_INT_LOWER WIDGET_INTDEST_LOWER_ADDR#define XBOW_WID_ERR_CMDWORD WIDGET_ERR_CMD_WORD#define XBOW_WID_LLP WIDGET_LLP_CFG#define XBOW_WID_STAT_CLR WIDGET_TFLUSH#define XBOW_WID_ARB_RELOAD 0x5c#define XBOW_WID_PERF_CTR_A 0x64#define XBOW_WID_PERF_CTR_B 0x6c#define XBOW_WID_NIC 0x74/* Xbridge only */#define XBOW_W0_RST_FNC 0x00007C#define XBOW_L8_RST_FNC 0x000084#define XBOW_L9_RST_FNC 0x00008c#define XBOW_LA_RST_FNC 0x000094#define XBOW_LB_RST_FNC 0x00009c#define XBOW_LC_RST_FNC 0x0000a4#define XBOW_LD_RST_FNC 0x0000ac#define XBOW_LE_RST_FNC 0x0000b4#define XBOW_LF_RST_FNC 0x0000bc#define XBOW_RESET_FENCE(x) ((x) > 7 && (x) < 16) ? \ (XBOW_W0_RST_FNC + ((x) - 7) * 8) : \ ((x) == 0) ? XBOW_W0_RST_FNC : 0#define XBOW_LOCK 0x0000c4#define XBOW_LOCK_CLR 0x0000cc/* End of Xbridge only *//* used only in ide, but defined here within the reserved portion *//* of the widget0 address space (before 0xf4) */#define XBOW_WID_UNDEF 0xe4/* pointer to link arbitration register, given xbow base, dst and src widget id */#define XBOW_PRIO_ARBREG_PTR(base, dst_wid, src_wid) \ XBOW_REG_PTR(XBOW_PRIO_LINKREGS_PTR(base, dst_wid), XBOW_ARB_OFF(src_wid))/* pointer to link registers base, given xbow base and destination widget id */#define XBOW_PRIO_LINKREGS_PTR(base, dst_wid) (xb_linkregs_t*) \ XBOW_REG_PTR(base, XB_LINK_REG_BASE(dst_wid))/* xbow link register set base, legal value for x is 0x8..0xf */#define XB_LINK_BASE 0x100#define XB_LINK_OFFSET 0x40#define XB_LINK_REG_BASE(x) (XB_LINK_BASE + ((x) & (MAX_XBOW_PORTS - 1)) * XB_LINK_OFFSET)#define XB_LINK_IBUF_FLUSH(x) (XB_LINK_REG_BASE(x) + 0x4)#define XB_LINK_CTRL(x) (XB_LINK_REG_BASE(x) + 0xc)#define XB_LINK_STATUS(x) (XB_LINK_REG_BASE(x) + 0x14)#define XB_LINK_ARB_UPPER(x) (XB_LINK_REG_BASE(x) + 0x1c)#define XB_LINK_ARB_LOWER(x) (XB_LINK_REG_BASE(x) + 0x24)#define XB_LINK_STATUS_CLR(x) (XB_LINK_REG_BASE(x) + 0x2c)#define XB_LINK_RESET(x) (XB_LINK_REG_BASE(x) + 0x34)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -