18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 38c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 48c2ecf20Sopenharmony_ci * for more details. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * bridge.h - bridge chip header file, derived from IRIX <sys/PCI/bridge.h>, 78c2ecf20Sopenharmony_ci * revision 1.76. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Copyright (C) 1996, 1999 Silcon Graphics, Inc. 108c2ecf20Sopenharmony_ci * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org) 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci#ifndef _ASM_PCI_BRIDGE_H 138c2ecf20Sopenharmony_ci#define _ASM_PCI_BRIDGE_H 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include <linux/types.h> 168c2ecf20Sopenharmony_ci#include <linux/pci.h> 178c2ecf20Sopenharmony_ci#include <asm/xtalk/xwidget.h> /* generic widget header */ 188c2ecf20Sopenharmony_ci#include <asm/sn/types.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* I/O page size */ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define IOPFNSHIFT 12 /* 4K per mapped page */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define IOPGSIZE (1 << IOPFNSHIFT) 258c2ecf20Sopenharmony_ci#define IOPG(x) ((x) >> IOPFNSHIFT) 268c2ecf20Sopenharmony_ci#define IOPGOFF(x) ((x) & (IOPGSIZE-1)) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci/* Bridge RAM sizes */ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define BRIDGE_ATE_RAM_SIZE 0x00000400 /* 1kB ATE RAM */ 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define BRIDGE_CONFIG_BASE 0x20000 338c2ecf20Sopenharmony_ci#define BRIDGE_CONFIG1_BASE 0x28000 348c2ecf20Sopenharmony_ci#define BRIDGE_CONFIG_END 0x30000 358c2ecf20Sopenharmony_ci#define BRIDGE_CONFIG_SLOT_SIZE 0x1000 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define BRIDGE_SSRAM_512K 0x00080000 /* 512kB */ 388c2ecf20Sopenharmony_ci#define BRIDGE_SSRAM_128K 0x00020000 /* 128kB */ 398c2ecf20Sopenharmony_ci#define BRIDGE_SSRAM_64K 0x00010000 /* 64kB */ 408c2ecf20Sopenharmony_ci#define BRIDGE_SSRAM_0K 0x00000000 /* 0kB */ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci/* ======================================================================== 438c2ecf20Sopenharmony_ci * Bridge address map 448c2ecf20Sopenharmony_ci */ 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define ATE_V 0x01 498c2ecf20Sopenharmony_ci#define ATE_CO 0x02 508c2ecf20Sopenharmony_ci#define ATE_PREC 0x04 518c2ecf20Sopenharmony_ci#define ATE_PREF 0x08 528c2ecf20Sopenharmony_ci#define ATE_BAR 0x10 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define ATE_PFNSHIFT 12 558c2ecf20Sopenharmony_ci#define ATE_TIDSHIFT 8 568c2ecf20Sopenharmony_ci#define ATE_RMFSHIFT 48 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define mkate(xaddr, xid, attr) (((xaddr) & 0x0000fffffffff000ULL) | \ 598c2ecf20Sopenharmony_ci ((xid)<<ATE_TIDSHIFT) | \ 608c2ecf20Sopenharmony_ci (attr)) 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define BRIDGE_INTERNAL_ATES 128 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* 658c2ecf20Sopenharmony_ci * It is generally preferred that hardware registers on the bridge 668c2ecf20Sopenharmony_ci * are located from C code via this structure. 678c2ecf20Sopenharmony_ci * 688c2ecf20Sopenharmony_ci * Generated from Bridge spec dated 04oct95 698c2ecf20Sopenharmony_ci */ 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_cistruct bridge_regs { 728c2ecf20Sopenharmony_ci /* Local Registers 0x000000-0x00FFFF */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci /* standard widget configuration 0x000000-0x000057 */ 758c2ecf20Sopenharmony_ci widget_cfg_t b_widget; /* 0x000000 */ 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci /* helper fieldnames for accessing bridge widget */ 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#define b_wid_id b_widget.w_id 808c2ecf20Sopenharmony_ci#define b_wid_stat b_widget.w_status 818c2ecf20Sopenharmony_ci#define b_wid_err_upper b_widget.w_err_upper_addr 828c2ecf20Sopenharmony_ci#define b_wid_err_lower b_widget.w_err_lower_addr 838c2ecf20Sopenharmony_ci#define b_wid_control b_widget.w_control 848c2ecf20Sopenharmony_ci#define b_wid_req_timeout b_widget.w_req_timeout 858c2ecf20Sopenharmony_ci#define b_wid_int_upper b_widget.w_intdest_upper_addr 868c2ecf20Sopenharmony_ci#define b_wid_int_lower b_widget.w_intdest_lower_addr 878c2ecf20Sopenharmony_ci#define b_wid_err_cmdword b_widget.w_err_cmd_word 888c2ecf20Sopenharmony_ci#define b_wid_llp b_widget.w_llp_cfg 898c2ecf20Sopenharmony_ci#define b_wid_tflush b_widget.w_tflush 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci /* bridge-specific widget configuration 0x000058-0x00007F */ 928c2ecf20Sopenharmony_ci u32 _pad_000058; 938c2ecf20Sopenharmony_ci u32 b_wid_aux_err; /* 0x00005C */ 948c2ecf20Sopenharmony_ci u32 _pad_000060; 958c2ecf20Sopenharmony_ci u32 b_wid_resp_upper; /* 0x000064 */ 968c2ecf20Sopenharmony_ci u32 _pad_000068; 978c2ecf20Sopenharmony_ci u32 b_wid_resp_lower; /* 0x00006C */ 988c2ecf20Sopenharmony_ci u32 _pad_000070; 998c2ecf20Sopenharmony_ci u32 b_wid_tst_pin_ctrl; /* 0x000074 */ 1008c2ecf20Sopenharmony_ci u32 _pad_000078[2]; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci /* PMU & Map 0x000080-0x00008F */ 1038c2ecf20Sopenharmony_ci u32 _pad_000080; 1048c2ecf20Sopenharmony_ci u32 b_dir_map; /* 0x000084 */ 1058c2ecf20Sopenharmony_ci u32 _pad_000088[2]; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci /* SSRAM 0x000090-0x00009F */ 1088c2ecf20Sopenharmony_ci u32 _pad_000090; 1098c2ecf20Sopenharmony_ci u32 b_ram_perr; /* 0x000094 */ 1108c2ecf20Sopenharmony_ci u32 _pad_000098[2]; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci /* Arbitration 0x0000A0-0x0000AF */ 1138c2ecf20Sopenharmony_ci u32 _pad_0000A0; 1148c2ecf20Sopenharmony_ci u32 b_arb; /* 0x0000A4 */ 1158c2ecf20Sopenharmony_ci u32 _pad_0000A8[2]; 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci /* Number In A Can 0x0000B0-0x0000BF */ 1188c2ecf20Sopenharmony_ci u32 _pad_0000B0; 1198c2ecf20Sopenharmony_ci u32 b_nic; /* 0x0000B4 */ 1208c2ecf20Sopenharmony_ci u32 _pad_0000B8[2]; 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci /* PCI/GIO 0x0000C0-0x0000FF */ 1238c2ecf20Sopenharmony_ci u32 _pad_0000C0; 1248c2ecf20Sopenharmony_ci u32 b_bus_timeout; /* 0x0000C4 */ 1258c2ecf20Sopenharmony_ci#define b_pci_bus_timeout b_bus_timeout 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci u32 _pad_0000C8; 1288c2ecf20Sopenharmony_ci u32 b_pci_cfg; /* 0x0000CC */ 1298c2ecf20Sopenharmony_ci u32 _pad_0000D0; 1308c2ecf20Sopenharmony_ci u32 b_pci_err_upper; /* 0x0000D4 */ 1318c2ecf20Sopenharmony_ci u32 _pad_0000D8; 1328c2ecf20Sopenharmony_ci u32 b_pci_err_lower; /* 0x0000DC */ 1338c2ecf20Sopenharmony_ci u32 _pad_0000E0[8]; 1348c2ecf20Sopenharmony_ci#define b_gio_err_lower b_pci_err_lower 1358c2ecf20Sopenharmony_ci#define b_gio_err_upper b_pci_err_upper 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci /* Interrupt 0x000100-0x0001FF */ 1388c2ecf20Sopenharmony_ci u32 _pad_000100; 1398c2ecf20Sopenharmony_ci u32 b_int_status; /* 0x000104 */ 1408c2ecf20Sopenharmony_ci u32 _pad_000108; 1418c2ecf20Sopenharmony_ci u32 b_int_enable; /* 0x00010C */ 1428c2ecf20Sopenharmony_ci u32 _pad_000110; 1438c2ecf20Sopenharmony_ci u32 b_int_rst_stat; /* 0x000114 */ 1448c2ecf20Sopenharmony_ci u32 _pad_000118; 1458c2ecf20Sopenharmony_ci u32 b_int_mode; /* 0x00011C */ 1468c2ecf20Sopenharmony_ci u32 _pad_000120; 1478c2ecf20Sopenharmony_ci u32 b_int_device; /* 0x000124 */ 1488c2ecf20Sopenharmony_ci u32 _pad_000128; 1498c2ecf20Sopenharmony_ci u32 b_int_host_err; /* 0x00012C */ 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci struct { 1528c2ecf20Sopenharmony_ci u32 __pad; /* 0x0001{30,,,68} */ 1538c2ecf20Sopenharmony_ci u32 addr; /* 0x0001{34,,,6C} */ 1548c2ecf20Sopenharmony_ci } b_int_addr[8]; /* 0x000130 */ 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci u32 _pad_000170[36]; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci /* Device 0x000200-0x0003FF */ 1598c2ecf20Sopenharmony_ci struct { 1608c2ecf20Sopenharmony_ci u32 __pad; /* 0x0002{00,,,38} */ 1618c2ecf20Sopenharmony_ci u32 reg; /* 0x0002{04,,,3C} */ 1628c2ecf20Sopenharmony_ci } b_device[8]; /* 0x000200 */ 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci struct { 1658c2ecf20Sopenharmony_ci u32 __pad; /* 0x0002{40,,,78} */ 1668c2ecf20Sopenharmony_ci u32 reg; /* 0x0002{44,,,7C} */ 1678c2ecf20Sopenharmony_ci } b_wr_req_buf[8]; /* 0x000240 */ 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci struct { 1708c2ecf20Sopenharmony_ci u32 __pad; /* 0x0002{80,,,88} */ 1718c2ecf20Sopenharmony_ci u32 reg; /* 0x0002{84,,,8C} */ 1728c2ecf20Sopenharmony_ci } b_rrb_map[2]; /* 0x000280 */ 1738c2ecf20Sopenharmony_ci#define b_even_resp b_rrb_map[0].reg /* 0x000284 */ 1748c2ecf20Sopenharmony_ci#define b_odd_resp b_rrb_map[1].reg /* 0x00028C */ 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci u32 _pad_000290; 1778c2ecf20Sopenharmony_ci u32 b_resp_status; /* 0x000294 */ 1788c2ecf20Sopenharmony_ci u32 _pad_000298; 1798c2ecf20Sopenharmony_ci u32 b_resp_clear; /* 0x00029C */ 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci u32 _pad_0002A0[24]; 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci char _pad_000300[0x10000 - 0x000300]; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci /* Internal Address Translation Entry RAM 0x010000-0x0103FF */ 1868c2ecf20Sopenharmony_ci union { 1878c2ecf20Sopenharmony_ci u64 wr; /* write-only */ 1888c2ecf20Sopenharmony_ci struct { 1898c2ecf20Sopenharmony_ci u32 _p_pad; 1908c2ecf20Sopenharmony_ci u32 rd; /* read-only */ 1918c2ecf20Sopenharmony_ci } hi; 1928c2ecf20Sopenharmony_ci } b_int_ate_ram[128]; 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ci char _pad_010400[0x11000 - 0x010400]; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci /* Internal Address Translation Entry RAM LOW 0x011000-0x0113FF */ 1978c2ecf20Sopenharmony_ci struct { 1988c2ecf20Sopenharmony_ci u32 _p_pad; 1998c2ecf20Sopenharmony_ci u32 rd; /* read-only */ 2008c2ecf20Sopenharmony_ci } b_int_ate_ram_lo[128]; 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_ci char _pad_011400[0x20000 - 0x011400]; 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci /* PCI Device Configuration Spaces 0x020000-0x027FFF */ 2058c2ecf20Sopenharmony_ci union { /* make all access sizes available. */ 2068c2ecf20Sopenharmony_ci u8 c[0x1000 / 1]; 2078c2ecf20Sopenharmony_ci u16 s[0x1000 / 2]; 2088c2ecf20Sopenharmony_ci u32 l[0x1000 / 4]; 2098c2ecf20Sopenharmony_ci u64 d[0x1000 / 8]; 2108c2ecf20Sopenharmony_ci union { 2118c2ecf20Sopenharmony_ci u8 c[0x100 / 1]; 2128c2ecf20Sopenharmony_ci u16 s[0x100 / 2]; 2138c2ecf20Sopenharmony_ci u32 l[0x100 / 4]; 2148c2ecf20Sopenharmony_ci u64 d[0x100 / 8]; 2158c2ecf20Sopenharmony_ci } f[8]; 2168c2ecf20Sopenharmony_ci } b_type0_cfg_dev[8]; /* 0x020000 */ 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci /* PCI Type 1 Configuration Space 0x028000-0x028FFF */ 2198c2ecf20Sopenharmony_ci union { /* make all access sizes available. */ 2208c2ecf20Sopenharmony_ci u8 c[0x1000 / 1]; 2218c2ecf20Sopenharmony_ci u16 s[0x1000 / 2]; 2228c2ecf20Sopenharmony_ci u32 l[0x1000 / 4]; 2238c2ecf20Sopenharmony_ci u64 d[0x1000 / 8]; 2248c2ecf20Sopenharmony_ci } b_type1_cfg; /* 0x028000-0x029000 */ 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci char _pad_029000[0x007000]; /* 0x029000-0x030000 */ 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci /* PCI Interrupt Acknowledge Cycle 0x030000 */ 2298c2ecf20Sopenharmony_ci union { 2308c2ecf20Sopenharmony_ci u8 c[8 / 1]; 2318c2ecf20Sopenharmony_ci u16 s[8 / 2]; 2328c2ecf20Sopenharmony_ci u32 l[8 / 4]; 2338c2ecf20Sopenharmony_ci u64 d[8 / 8]; 2348c2ecf20Sopenharmony_ci } b_pci_iack; /* 0x030000 */ 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci u8 _pad_030007[0x04fff8]; /* 0x030008-0x07FFFF */ 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci /* External Address Translation Entry RAM 0x080000-0x0FFFFF */ 2398c2ecf20Sopenharmony_ci u64 b_ext_ate_ram[0x10000]; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci /* Reserved 0x100000-0x1FFFFF */ 2428c2ecf20Sopenharmony_ci char _pad_100000[0x200000-0x100000]; 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci /* PCI/GIO Device Spaces 0x200000-0xBFFFFF */ 2458c2ecf20Sopenharmony_ci union { /* make all access sizes available. */ 2468c2ecf20Sopenharmony_ci u8 c[0x100000 / 1]; 2478c2ecf20Sopenharmony_ci u16 s[0x100000 / 2]; 2488c2ecf20Sopenharmony_ci u32 l[0x100000 / 4]; 2498c2ecf20Sopenharmony_ci u64 d[0x100000 / 8]; 2508c2ecf20Sopenharmony_ci } b_devio_raw[10]; /* 0x200000 */ 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci /* b_devio macro is a bit strange; it reflects the 2538c2ecf20Sopenharmony_ci * fact that the Bridge ASIC provides 2M for the 2548c2ecf20Sopenharmony_ci * first two DevIO windows and 1M for the other six. 2558c2ecf20Sopenharmony_ci */ 2568c2ecf20Sopenharmony_ci#define b_devio(n) b_devio_raw[((n)<2)?(n*2):(n+2)] 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci /* External Flash Proms 1,0 0xC00000-0xFFFFFF */ 2598c2ecf20Sopenharmony_ci union { /* make all access sizes available. */ 2608c2ecf20Sopenharmony_ci u8 c[0x400000 / 1]; /* read-only */ 2618c2ecf20Sopenharmony_ci u16 s[0x400000 / 2]; /* read-write */ 2628c2ecf20Sopenharmony_ci u32 l[0x400000 / 4]; /* read-only */ 2638c2ecf20Sopenharmony_ci u64 d[0x400000 / 8]; /* read-only */ 2648c2ecf20Sopenharmony_ci } b_external_flash; /* 0xC00000 */ 2658c2ecf20Sopenharmony_ci}; 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci/* 2688c2ecf20Sopenharmony_ci * Field formats for Error Command Word and Auxiliary Error Command Word 2698c2ecf20Sopenharmony_ci * of bridge. 2708c2ecf20Sopenharmony_ci */ 2718c2ecf20Sopenharmony_cistruct bridge_err_cmdword { 2728c2ecf20Sopenharmony_ci union { 2738c2ecf20Sopenharmony_ci u32 cmd_word; 2748c2ecf20Sopenharmony_ci struct { 2758c2ecf20Sopenharmony_ci u32 didn:4, /* Destination ID */ 2768c2ecf20Sopenharmony_ci sidn:4, /* Source ID */ 2778c2ecf20Sopenharmony_ci pactyp:4, /* Packet type */ 2788c2ecf20Sopenharmony_ci tnum:5, /* Trans Number */ 2798c2ecf20Sopenharmony_ci coh:1, /* Coh Transaction */ 2808c2ecf20Sopenharmony_ci ds:2, /* Data size */ 2818c2ecf20Sopenharmony_ci gbr:1, /* GBR enable */ 2828c2ecf20Sopenharmony_ci vbpm:1, /* VBPM message */ 2838c2ecf20Sopenharmony_ci error:1, /* Error occurred */ 2848c2ecf20Sopenharmony_ci barr:1, /* Barrier op */ 2858c2ecf20Sopenharmony_ci rsvd:8; 2868c2ecf20Sopenharmony_ci } berr_st; 2878c2ecf20Sopenharmony_ci } berr_un; 2888c2ecf20Sopenharmony_ci}; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci#define berr_field berr_un.berr_st 2918c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci/* 2948c2ecf20Sopenharmony_ci * The values of these macros can and should be crosschecked 2958c2ecf20Sopenharmony_ci * regularly against the offsets of the like-named fields 2968c2ecf20Sopenharmony_ci * within the bridge_regs structure above. 2978c2ecf20Sopenharmony_ci */ 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci/* Byte offset macros for Bridge internal registers */ 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci#define BRIDGE_WID_ID WIDGET_ID 3028c2ecf20Sopenharmony_ci#define BRIDGE_WID_STAT WIDGET_STATUS 3038c2ecf20Sopenharmony_ci#define BRIDGE_WID_ERR_UPPER WIDGET_ERR_UPPER_ADDR 3048c2ecf20Sopenharmony_ci#define BRIDGE_WID_ERR_LOWER WIDGET_ERR_LOWER_ADDR 3058c2ecf20Sopenharmony_ci#define BRIDGE_WID_CONTROL WIDGET_CONTROL 3068c2ecf20Sopenharmony_ci#define BRIDGE_WID_REQ_TIMEOUT WIDGET_REQ_TIMEOUT 3078c2ecf20Sopenharmony_ci#define BRIDGE_WID_INT_UPPER WIDGET_INTDEST_UPPER_ADDR 3088c2ecf20Sopenharmony_ci#define BRIDGE_WID_INT_LOWER WIDGET_INTDEST_LOWER_ADDR 3098c2ecf20Sopenharmony_ci#define BRIDGE_WID_ERR_CMDWORD WIDGET_ERR_CMD_WORD 3108c2ecf20Sopenharmony_ci#define BRIDGE_WID_LLP WIDGET_LLP_CFG 3118c2ecf20Sopenharmony_ci#define BRIDGE_WID_TFLUSH WIDGET_TFLUSH 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci#define BRIDGE_WID_AUX_ERR 0x00005C /* Aux Error Command Word */ 3148c2ecf20Sopenharmony_ci#define BRIDGE_WID_RESP_UPPER 0x000064 /* Response Buf Upper Addr */ 3158c2ecf20Sopenharmony_ci#define BRIDGE_WID_RESP_LOWER 0x00006C /* Response Buf Lower Addr */ 3168c2ecf20Sopenharmony_ci#define BRIDGE_WID_TST_PIN_CTRL 0x000074 /* Test pin control */ 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci#define BRIDGE_DIR_MAP 0x000084 /* Direct Map reg */ 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci#define BRIDGE_RAM_PERR 0x000094 /* SSRAM Parity Error */ 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci#define BRIDGE_ARB 0x0000A4 /* Arbitration Priority reg */ 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci#define BRIDGE_NIC 0x0000B4 /* Number In A Can */ 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci#define BRIDGE_BUS_TIMEOUT 0x0000C4 /* Bus Timeout Register */ 3278c2ecf20Sopenharmony_ci#define BRIDGE_PCI_BUS_TIMEOUT BRIDGE_BUS_TIMEOUT 3288c2ecf20Sopenharmony_ci#define BRIDGE_PCI_CFG 0x0000CC /* PCI Type 1 Config reg */ 3298c2ecf20Sopenharmony_ci#define BRIDGE_PCI_ERR_UPPER 0x0000D4 /* PCI error Upper Addr */ 3308c2ecf20Sopenharmony_ci#define BRIDGE_PCI_ERR_LOWER 0x0000DC /* PCI error Lower Addr */ 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci#define BRIDGE_INT_STATUS 0x000104 /* Interrupt Status */ 3338c2ecf20Sopenharmony_ci#define BRIDGE_INT_ENABLE 0x00010C /* Interrupt Enables */ 3348c2ecf20Sopenharmony_ci#define BRIDGE_INT_RST_STAT 0x000114 /* Reset Intr Status */ 3358c2ecf20Sopenharmony_ci#define BRIDGE_INT_MODE 0x00011C /* Interrupt Mode */ 3368c2ecf20Sopenharmony_ci#define BRIDGE_INT_DEVICE 0x000124 /* Interrupt Device */ 3378c2ecf20Sopenharmony_ci#define BRIDGE_INT_HOST_ERR 0x00012C /* Host Error Field */ 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_ci#define BRIDGE_INT_ADDR0 0x000134 /* Host Address Reg */ 3408c2ecf20Sopenharmony_ci#define BRIDGE_INT_ADDR_OFF 0x000008 /* Host Addr offset (1..7) */ 3418c2ecf20Sopenharmony_ci#define BRIDGE_INT_ADDR(x) (BRIDGE_INT_ADDR0+(x)*BRIDGE_INT_ADDR_OFF) 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci#define BRIDGE_DEVICE0 0x000204 /* Device 0 */ 3448c2ecf20Sopenharmony_ci#define BRIDGE_DEVICE_OFF 0x000008 /* Device offset (1..7) */ 3458c2ecf20Sopenharmony_ci#define BRIDGE_DEVICE(x) (BRIDGE_DEVICE0+(x)*BRIDGE_DEVICE_OFF) 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_ci#define BRIDGE_WR_REQ_BUF0 0x000244 /* Write Request Buffer 0 */ 3488c2ecf20Sopenharmony_ci#define BRIDGE_WR_REQ_BUF_OFF 0x000008 /* Buffer Offset (1..7) */ 3498c2ecf20Sopenharmony_ci#define BRIDGE_WR_REQ_BUF(x) (BRIDGE_WR_REQ_BUF0+(x)*BRIDGE_WR_REQ_BUF_OFF) 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci#define BRIDGE_EVEN_RESP 0x000284 /* Even Device Response Buf */ 3528c2ecf20Sopenharmony_ci#define BRIDGE_ODD_RESP 0x00028C /* Odd Device Response Buf */ 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci#define BRIDGE_RESP_STATUS 0x000294 /* Read Response Status reg */ 3558c2ecf20Sopenharmony_ci#define BRIDGE_RESP_CLEAR 0x00029C /* Read Response Clear reg */ 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_ci/* Byte offset macros for Bridge I/O space */ 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_ci#define BRIDGE_ATE_RAM 0x00010000 /* Internal Addr Xlat Ram */ 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_ci#define BRIDGE_TYPE0_CFG_DEV0 0x00020000 /* Type 0 Cfg, Device 0 */ 3628c2ecf20Sopenharmony_ci#define BRIDGE_TYPE0_CFG_SLOT_OFF 0x00001000 /* Type 0 Cfg Slot Offset (1..7) */ 3638c2ecf20Sopenharmony_ci#define BRIDGE_TYPE0_CFG_FUNC_OFF 0x00000100 /* Type 0 Cfg Func Offset (1..7) */ 3648c2ecf20Sopenharmony_ci#define BRIDGE_TYPE0_CFG_DEV(s) (BRIDGE_TYPE0_CFG_DEV0+\ 3658c2ecf20Sopenharmony_ci (s)*BRIDGE_TYPE0_CFG_SLOT_OFF) 3668c2ecf20Sopenharmony_ci#define BRIDGE_TYPE0_CFG_DEVF(s, f) (BRIDGE_TYPE0_CFG_DEV0+\ 3678c2ecf20Sopenharmony_ci (s)*BRIDGE_TYPE0_CFG_SLOT_OFF+\ 3688c2ecf20Sopenharmony_ci (f)*BRIDGE_TYPE0_CFG_FUNC_OFF) 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ci#define BRIDGE_TYPE1_CFG 0x00028000 /* Type 1 Cfg space */ 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci#define BRIDGE_PCI_IACK 0x00030000 /* PCI Interrupt Ack */ 3738c2ecf20Sopenharmony_ci#define BRIDGE_EXT_SSRAM 0x00080000 /* Extern SSRAM (ATE) */ 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_ci/* Byte offset macros for Bridge device IO spaces */ 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci#define BRIDGE_DEV_CNT 8 /* Up to 8 devices per bridge */ 3788c2ecf20Sopenharmony_ci#define BRIDGE_DEVIO0 0x00200000 /* Device IO 0 Addr */ 3798c2ecf20Sopenharmony_ci#define BRIDGE_DEVIO1 0x00400000 /* Device IO 1 Addr */ 3808c2ecf20Sopenharmony_ci#define BRIDGE_DEVIO2 0x00600000 /* Device IO 2 Addr */ 3818c2ecf20Sopenharmony_ci#define BRIDGE_DEVIO_OFF 0x00100000 /* Device IO Offset (3..7) */ 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci#define BRIDGE_DEVIO_2MB 0x00200000 /* Device IO Offset (0..1) */ 3848c2ecf20Sopenharmony_ci#define BRIDGE_DEVIO_1MB 0x00100000 /* Device IO Offset (2..7) */ 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_ci#define BRIDGE_DEVIO(x) ((x)<=1 ? BRIDGE_DEVIO0+(x)*BRIDGE_DEVIO_2MB : BRIDGE_DEVIO2+((x)-2)*BRIDGE_DEVIO_1MB) 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_ci#define BRIDGE_EXTERNAL_FLASH 0x00C00000 /* External Flash PROMS */ 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ci/* ======================================================================== 3918c2ecf20Sopenharmony_ci * Bridge register bit field definitions 3928c2ecf20Sopenharmony_ci */ 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ci/* Widget part number of bridge */ 3958c2ecf20Sopenharmony_ci#define BRIDGE_WIDGET_PART_NUM 0xc002 3968c2ecf20Sopenharmony_ci#define XBRIDGE_WIDGET_PART_NUM 0xd002 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ci/* Manufacturer of bridge */ 3998c2ecf20Sopenharmony_ci#define BRIDGE_WIDGET_MFGR_NUM 0x036 4008c2ecf20Sopenharmony_ci#define XBRIDGE_WIDGET_MFGR_NUM 0x024 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_ci/* Revision numbers for known Bridge revisions */ 4038c2ecf20Sopenharmony_ci#define BRIDGE_REV_A 0x1 4048c2ecf20Sopenharmony_ci#define BRIDGE_REV_B 0x2 4058c2ecf20Sopenharmony_ci#define BRIDGE_REV_C 0x3 4068c2ecf20Sopenharmony_ci#define BRIDGE_REV_D 0x4 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci/* Bridge widget status register bits definition */ 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci#define BRIDGE_STAT_LLP_REC_CNT (0xFFu << 24) 4118c2ecf20Sopenharmony_ci#define BRIDGE_STAT_LLP_TX_CNT (0xFF << 16) 4128c2ecf20Sopenharmony_ci#define BRIDGE_STAT_FLASH_SELECT (0x1 << 6) 4138c2ecf20Sopenharmony_ci#define BRIDGE_STAT_PCI_GIO_N (0x1 << 5) 4148c2ecf20Sopenharmony_ci#define BRIDGE_STAT_PENDING (0x1F << 0) 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci/* Bridge widget control register bits definition */ 4178c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_FLASH_WR_EN (0x1ul << 31) 4188c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_EN_CLK50 (0x1 << 30) 4198c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_EN_CLK40 (0x1 << 29) 4208c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_EN_CLK33 (0x1 << 28) 4218c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_RST(n) ((n) << 24) 4228c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_RST_MASK (BRIDGE_CTRL_RST(0xF)) 4238c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_RST_PIN(x) (BRIDGE_CTRL_RST(0x1 << (x))) 4248c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_IO_SWAP (0x1 << 23) 4258c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_MEM_SWAP (0x1 << 22) 4268c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_PAGE_SIZE (0x1 << 21) 4278c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_SS_PAR_BAD (0x1 << 20) 4288c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_SS_PAR_EN (0x1 << 19) 4298c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_SSRAM_SIZE(n) ((n) << 17) 4308c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_SSRAM_SIZE_MASK (BRIDGE_CTRL_SSRAM_SIZE(0x3)) 4318c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_SSRAM_512K (BRIDGE_CTRL_SSRAM_SIZE(0x3)) 4328c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_SSRAM_128K (BRIDGE_CTRL_SSRAM_SIZE(0x2)) 4338c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_SSRAM_64K (BRIDGE_CTRL_SSRAM_SIZE(0x1)) 4348c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_SSRAM_1K (BRIDGE_CTRL_SSRAM_SIZE(0x0)) 4358c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_F_BAD_PKT (0x1 << 16) 4368c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_LLP_XBAR_CRD(n) ((n) << 12) 4378c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_LLP_XBAR_CRD_MASK (BRIDGE_CTRL_LLP_XBAR_CRD(0xf)) 4388c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_CLR_RLLP_CNT (0x1 << 11) 4398c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_CLR_TLLP_CNT (0x1 << 10) 4408c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_SYS_END (0x1 << 9) 4418c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_MAX_TRANS(n) ((n) << 4) 4428c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_MAX_TRANS_MASK (BRIDGE_CTRL_MAX_TRANS(0x1f)) 4438c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_WIDGET_ID(n) ((n) << 0) 4448c2ecf20Sopenharmony_ci#define BRIDGE_CTRL_WIDGET_ID_MASK (BRIDGE_CTRL_WIDGET_ID(0xf)) 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ci/* Bridge Response buffer Error Upper Register bit fields definition */ 4478c2ecf20Sopenharmony_ci#define BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT (20) 4488c2ecf20Sopenharmony_ci#define BRIDGE_RESP_ERRUPPR_DEVNUM_MASK (0x7 << BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT) 4498c2ecf20Sopenharmony_ci#define BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT (16) 4508c2ecf20Sopenharmony_ci#define BRIDGE_RESP_ERRUPPR_BUFNUM_MASK (0xF << BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT) 4518c2ecf20Sopenharmony_ci#define BRIDGE_RESP_ERRRUPPR_BUFMASK (0xFFFF) 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_ci#define BRIDGE_RESP_ERRUPPR_BUFNUM(x) \ 4548c2ecf20Sopenharmony_ci (((x) & BRIDGE_RESP_ERRUPPR_BUFNUM_MASK) >> \ 4558c2ecf20Sopenharmony_ci BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT) 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_ci#define BRIDGE_RESP_ERRUPPR_DEVICE(x) \ 4588c2ecf20Sopenharmony_ci (((x) & BRIDGE_RESP_ERRUPPR_DEVNUM_MASK) >> \ 4598c2ecf20Sopenharmony_ci BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT) 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci/* Bridge direct mapping register bits definition */ 4628c2ecf20Sopenharmony_ci#define BRIDGE_DIRMAP_W_ID_SHFT 20 4638c2ecf20Sopenharmony_ci#define BRIDGE_DIRMAP_W_ID (0xf << BRIDGE_DIRMAP_W_ID_SHFT) 4648c2ecf20Sopenharmony_ci#define BRIDGE_DIRMAP_RMF_64 (0x1 << 18) 4658c2ecf20Sopenharmony_ci#define BRIDGE_DIRMAP_ADD512 (0x1 << 17) 4668c2ecf20Sopenharmony_ci#define BRIDGE_DIRMAP_OFF (0x1ffff << 0) 4678c2ecf20Sopenharmony_ci#define BRIDGE_DIRMAP_OFF_ADDRSHFT (31) /* lsbit of DIRMAP_OFF is xtalk address bit 31 */ 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ci/* Bridge Arbitration register bits definition */ 4708c2ecf20Sopenharmony_ci#define BRIDGE_ARB_REQ_WAIT_TICK(x) ((x) << 16) 4718c2ecf20Sopenharmony_ci#define BRIDGE_ARB_REQ_WAIT_TICK_MASK BRIDGE_ARB_REQ_WAIT_TICK(0x3) 4728c2ecf20Sopenharmony_ci#define BRIDGE_ARB_REQ_WAIT_EN(x) ((x) << 8) 4738c2ecf20Sopenharmony_ci#define BRIDGE_ARB_REQ_WAIT_EN_MASK BRIDGE_ARB_REQ_WAIT_EN(0xff) 4748c2ecf20Sopenharmony_ci#define BRIDGE_ARB_FREEZE_GNT (1 << 6) 4758c2ecf20Sopenharmony_ci#define BRIDGE_ARB_HPRI_RING_B2 (1 << 5) 4768c2ecf20Sopenharmony_ci#define BRIDGE_ARB_HPRI_RING_B1 (1 << 4) 4778c2ecf20Sopenharmony_ci#define BRIDGE_ARB_HPRI_RING_B0 (1 << 3) 4788c2ecf20Sopenharmony_ci#define BRIDGE_ARB_LPRI_RING_B2 (1 << 2) 4798c2ecf20Sopenharmony_ci#define BRIDGE_ARB_LPRI_RING_B1 (1 << 1) 4808c2ecf20Sopenharmony_ci#define BRIDGE_ARB_LPRI_RING_B0 (1 << 0) 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_ci/* Bridge Bus time-out register bits definition */ 4838c2ecf20Sopenharmony_ci#define BRIDGE_BUS_PCI_RETRY_HLD(x) ((x) << 16) 4848c2ecf20Sopenharmony_ci#define BRIDGE_BUS_PCI_RETRY_HLD_MASK BRIDGE_BUS_PCI_RETRY_HLD(0x1f) 4858c2ecf20Sopenharmony_ci#define BRIDGE_BUS_GIO_TIMEOUT (1 << 12) 4868c2ecf20Sopenharmony_ci#define BRIDGE_BUS_PCI_RETRY_CNT(x) ((x) << 0) 4878c2ecf20Sopenharmony_ci#define BRIDGE_BUS_PCI_RETRY_MASK BRIDGE_BUS_PCI_RETRY_CNT(0x3ff) 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci/* Bridge interrupt status register bits definition */ 4908c2ecf20Sopenharmony_ci#define BRIDGE_ISR_MULTI_ERR (0x1u << 31) 4918c2ecf20Sopenharmony_ci#define BRIDGE_ISR_PMU_ESIZE_FAULT (0x1 << 30) 4928c2ecf20Sopenharmony_ci#define BRIDGE_ISR_UNEXP_RESP (0x1 << 29) 4938c2ecf20Sopenharmony_ci#define BRIDGE_ISR_BAD_XRESP_PKT (0x1 << 28) 4948c2ecf20Sopenharmony_ci#define BRIDGE_ISR_BAD_XREQ_PKT (0x1 << 27) 4958c2ecf20Sopenharmony_ci#define BRIDGE_ISR_RESP_XTLK_ERR (0x1 << 26) 4968c2ecf20Sopenharmony_ci#define BRIDGE_ISR_REQ_XTLK_ERR (0x1 << 25) 4978c2ecf20Sopenharmony_ci#define BRIDGE_ISR_INVLD_ADDR (0x1 << 24) 4988c2ecf20Sopenharmony_ci#define BRIDGE_ISR_UNSUPPORTED_XOP (0x1 << 23) 4998c2ecf20Sopenharmony_ci#define BRIDGE_ISR_XREQ_FIFO_OFLOW (0x1 << 22) 5008c2ecf20Sopenharmony_ci#define BRIDGE_ISR_LLP_REC_SNERR (0x1 << 21) 5018c2ecf20Sopenharmony_ci#define BRIDGE_ISR_LLP_REC_CBERR (0x1 << 20) 5028c2ecf20Sopenharmony_ci#define BRIDGE_ISR_LLP_RCTY (0x1 << 19) 5038c2ecf20Sopenharmony_ci#define BRIDGE_ISR_LLP_TX_RETRY (0x1 << 18) 5048c2ecf20Sopenharmony_ci#define BRIDGE_ISR_LLP_TCTY (0x1 << 17) 5058c2ecf20Sopenharmony_ci#define BRIDGE_ISR_SSRAM_PERR (0x1 << 16) 5068c2ecf20Sopenharmony_ci#define BRIDGE_ISR_PCI_ABORT (0x1 << 15) 5078c2ecf20Sopenharmony_ci#define BRIDGE_ISR_PCI_PARITY (0x1 << 14) 5088c2ecf20Sopenharmony_ci#define BRIDGE_ISR_PCI_SERR (0x1 << 13) 5098c2ecf20Sopenharmony_ci#define BRIDGE_ISR_PCI_PERR (0x1 << 12) 5108c2ecf20Sopenharmony_ci#define BRIDGE_ISR_PCI_MST_TIMEOUT (0x1 << 11) 5118c2ecf20Sopenharmony_ci#define BRIDGE_ISR_GIO_MST_TIMEOUT BRIDGE_ISR_PCI_MST_TIMEOUT 5128c2ecf20Sopenharmony_ci#define BRIDGE_ISR_PCI_RETRY_CNT (0x1 << 10) 5138c2ecf20Sopenharmony_ci#define BRIDGE_ISR_XREAD_REQ_TIMEOUT (0x1 << 9) 5148c2ecf20Sopenharmony_ci#define BRIDGE_ISR_GIO_B_ENBL_ERR (0x1 << 8) 5158c2ecf20Sopenharmony_ci#define BRIDGE_ISR_INT_MSK (0xff << 0) 5168c2ecf20Sopenharmony_ci#define BRIDGE_ISR_INT(x) (0x1 << (x)) 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci#define BRIDGE_ISR_LINK_ERROR \ 5198c2ecf20Sopenharmony_ci (BRIDGE_ISR_LLP_REC_SNERR|BRIDGE_ISR_LLP_REC_CBERR| \ 5208c2ecf20Sopenharmony_ci BRIDGE_ISR_LLP_RCTY|BRIDGE_ISR_LLP_TX_RETRY| \ 5218c2ecf20Sopenharmony_ci BRIDGE_ISR_LLP_TCTY) 5228c2ecf20Sopenharmony_ci 5238c2ecf20Sopenharmony_ci#define BRIDGE_ISR_PCIBUS_PIOERR \ 5248c2ecf20Sopenharmony_ci (BRIDGE_ISR_PCI_MST_TIMEOUT|BRIDGE_ISR_PCI_ABORT) 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ci#define BRIDGE_ISR_PCIBUS_ERROR \ 5278c2ecf20Sopenharmony_ci (BRIDGE_ISR_PCIBUS_PIOERR|BRIDGE_ISR_PCI_PERR| \ 5288c2ecf20Sopenharmony_ci BRIDGE_ISR_PCI_SERR|BRIDGE_ISR_PCI_RETRY_CNT| \ 5298c2ecf20Sopenharmony_ci BRIDGE_ISR_PCI_PARITY) 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_ci#define BRIDGE_ISR_XTALK_ERROR \ 5328c2ecf20Sopenharmony_ci (BRIDGE_ISR_XREAD_REQ_TIMEOUT|BRIDGE_ISR_XREQ_FIFO_OFLOW|\ 5338c2ecf20Sopenharmony_ci BRIDGE_ISR_UNSUPPORTED_XOP|BRIDGE_ISR_INVLD_ADDR| \ 5348c2ecf20Sopenharmony_ci BRIDGE_ISR_REQ_XTLK_ERR|BRIDGE_ISR_RESP_XTLK_ERR| \ 5358c2ecf20Sopenharmony_ci BRIDGE_ISR_BAD_XREQ_PKT|BRIDGE_ISR_BAD_XRESP_PKT| \ 5368c2ecf20Sopenharmony_ci BRIDGE_ISR_UNEXP_RESP) 5378c2ecf20Sopenharmony_ci 5388c2ecf20Sopenharmony_ci#define BRIDGE_ISR_ERRORS \ 5398c2ecf20Sopenharmony_ci (BRIDGE_ISR_LINK_ERROR|BRIDGE_ISR_PCIBUS_ERROR| \ 5408c2ecf20Sopenharmony_ci BRIDGE_ISR_XTALK_ERROR|BRIDGE_ISR_SSRAM_PERR| \ 5418c2ecf20Sopenharmony_ci BRIDGE_ISR_PMU_ESIZE_FAULT) 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_ci/* 5448c2ecf20Sopenharmony_ci * List of Errors which are fatal and kill the system 5458c2ecf20Sopenharmony_ci */ 5468c2ecf20Sopenharmony_ci#define BRIDGE_ISR_ERROR_FATAL \ 5478c2ecf20Sopenharmony_ci ((BRIDGE_ISR_XTALK_ERROR & ~BRIDGE_ISR_XREAD_REQ_TIMEOUT)|\ 5488c2ecf20Sopenharmony_ci BRIDGE_ISR_PCI_SERR|BRIDGE_ISR_PCI_PARITY ) 5498c2ecf20Sopenharmony_ci 5508c2ecf20Sopenharmony_ci#define BRIDGE_ISR_ERROR_DUMP \ 5518c2ecf20Sopenharmony_ci (BRIDGE_ISR_PCIBUS_ERROR|BRIDGE_ISR_PMU_ESIZE_FAULT| \ 5528c2ecf20Sopenharmony_ci BRIDGE_ISR_XTALK_ERROR|BRIDGE_ISR_SSRAM_PERR) 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_ci/* Bridge interrupt enable register bits definition */ 5558c2ecf20Sopenharmony_ci#define BRIDGE_IMR_UNEXP_RESP BRIDGE_ISR_UNEXP_RESP 5568c2ecf20Sopenharmony_ci#define BRIDGE_IMR_PMU_ESIZE_FAULT BRIDGE_ISR_PMU_ESIZE_FAULT 5578c2ecf20Sopenharmony_ci#define BRIDGE_IMR_BAD_XRESP_PKT BRIDGE_ISR_BAD_XRESP_PKT 5588c2ecf20Sopenharmony_ci#define BRIDGE_IMR_BAD_XREQ_PKT BRIDGE_ISR_BAD_XREQ_PKT 5598c2ecf20Sopenharmony_ci#define BRIDGE_IMR_RESP_XTLK_ERR BRIDGE_ISR_RESP_XTLK_ERR 5608c2ecf20Sopenharmony_ci#define BRIDGE_IMR_REQ_XTLK_ERR BRIDGE_ISR_REQ_XTLK_ERR 5618c2ecf20Sopenharmony_ci#define BRIDGE_IMR_INVLD_ADDR BRIDGE_ISR_INVLD_ADDR 5628c2ecf20Sopenharmony_ci#define BRIDGE_IMR_UNSUPPORTED_XOP BRIDGE_ISR_UNSUPPORTED_XOP 5638c2ecf20Sopenharmony_ci#define BRIDGE_IMR_XREQ_FIFO_OFLOW BRIDGE_ISR_XREQ_FIFO_OFLOW 5648c2ecf20Sopenharmony_ci#define BRIDGE_IMR_LLP_REC_SNERR BRIDGE_ISR_LLP_REC_SNERR 5658c2ecf20Sopenharmony_ci#define BRIDGE_IMR_LLP_REC_CBERR BRIDGE_ISR_LLP_REC_CBERR 5668c2ecf20Sopenharmony_ci#define BRIDGE_IMR_LLP_RCTY BRIDGE_ISR_LLP_RCTY 5678c2ecf20Sopenharmony_ci#define BRIDGE_IMR_LLP_TX_RETRY BRIDGE_ISR_LLP_TX_RETRY 5688c2ecf20Sopenharmony_ci#define BRIDGE_IMR_LLP_TCTY BRIDGE_ISR_LLP_TCTY 5698c2ecf20Sopenharmony_ci#define BRIDGE_IMR_SSRAM_PERR BRIDGE_ISR_SSRAM_PERR 5708c2ecf20Sopenharmony_ci#define BRIDGE_IMR_PCI_ABORT BRIDGE_ISR_PCI_ABORT 5718c2ecf20Sopenharmony_ci#define BRIDGE_IMR_PCI_PARITY BRIDGE_ISR_PCI_PARITY 5728c2ecf20Sopenharmony_ci#define BRIDGE_IMR_PCI_SERR BRIDGE_ISR_PCI_SERR 5738c2ecf20Sopenharmony_ci#define BRIDGE_IMR_PCI_PERR BRIDGE_ISR_PCI_PERR 5748c2ecf20Sopenharmony_ci#define BRIDGE_IMR_PCI_MST_TIMEOUT BRIDGE_ISR_PCI_MST_TIMEOUT 5758c2ecf20Sopenharmony_ci#define BRIDGE_IMR_GIO_MST_TIMEOUT BRIDGE_ISR_GIO_MST_TIMEOUT 5768c2ecf20Sopenharmony_ci#define BRIDGE_IMR_PCI_RETRY_CNT BRIDGE_ISR_PCI_RETRY_CNT 5778c2ecf20Sopenharmony_ci#define BRIDGE_IMR_XREAD_REQ_TIMEOUT BRIDGE_ISR_XREAD_REQ_TIMEOUT 5788c2ecf20Sopenharmony_ci#define BRIDGE_IMR_GIO_B_ENBL_ERR BRIDGE_ISR_GIO_B_ENBL_ERR 5798c2ecf20Sopenharmony_ci#define BRIDGE_IMR_INT_MSK BRIDGE_ISR_INT_MSK 5808c2ecf20Sopenharmony_ci#define BRIDGE_IMR_INT(x) BRIDGE_ISR_INT(x) 5818c2ecf20Sopenharmony_ci 5828c2ecf20Sopenharmony_ci/* Bridge interrupt reset register bits definition */ 5838c2ecf20Sopenharmony_ci#define BRIDGE_IRR_MULTI_CLR (0x1 << 6) 5848c2ecf20Sopenharmony_ci#define BRIDGE_IRR_CRP_GRP_CLR (0x1 << 5) 5858c2ecf20Sopenharmony_ci#define BRIDGE_IRR_RESP_BUF_GRP_CLR (0x1 << 4) 5868c2ecf20Sopenharmony_ci#define BRIDGE_IRR_REQ_DSP_GRP_CLR (0x1 << 3) 5878c2ecf20Sopenharmony_ci#define BRIDGE_IRR_LLP_GRP_CLR (0x1 << 2) 5888c2ecf20Sopenharmony_ci#define BRIDGE_IRR_SSRAM_GRP_CLR (0x1 << 1) 5898c2ecf20Sopenharmony_ci#define BRIDGE_IRR_PCI_GRP_CLR (0x1 << 0) 5908c2ecf20Sopenharmony_ci#define BRIDGE_IRR_GIO_GRP_CLR (0x1 << 0) 5918c2ecf20Sopenharmony_ci#define BRIDGE_IRR_ALL_CLR 0x7f 5928c2ecf20Sopenharmony_ci 5938c2ecf20Sopenharmony_ci#define BRIDGE_IRR_CRP_GRP (BRIDGE_ISR_UNEXP_RESP | \ 5948c2ecf20Sopenharmony_ci BRIDGE_ISR_XREQ_FIFO_OFLOW) 5958c2ecf20Sopenharmony_ci#define BRIDGE_IRR_RESP_BUF_GRP (BRIDGE_ISR_BAD_XRESP_PKT | \ 5968c2ecf20Sopenharmony_ci BRIDGE_ISR_RESP_XTLK_ERR | \ 5978c2ecf20Sopenharmony_ci BRIDGE_ISR_XREAD_REQ_TIMEOUT) 5988c2ecf20Sopenharmony_ci#define BRIDGE_IRR_REQ_DSP_GRP (BRIDGE_ISR_UNSUPPORTED_XOP | \ 5998c2ecf20Sopenharmony_ci BRIDGE_ISR_BAD_XREQ_PKT | \ 6008c2ecf20Sopenharmony_ci BRIDGE_ISR_REQ_XTLK_ERR | \ 6018c2ecf20Sopenharmony_ci BRIDGE_ISR_INVLD_ADDR) 6028c2ecf20Sopenharmony_ci#define BRIDGE_IRR_LLP_GRP (BRIDGE_ISR_LLP_REC_SNERR | \ 6038c2ecf20Sopenharmony_ci BRIDGE_ISR_LLP_REC_CBERR | \ 6048c2ecf20Sopenharmony_ci BRIDGE_ISR_LLP_RCTY | \ 6058c2ecf20Sopenharmony_ci BRIDGE_ISR_LLP_TX_RETRY | \ 6068c2ecf20Sopenharmony_ci BRIDGE_ISR_LLP_TCTY) 6078c2ecf20Sopenharmony_ci#define BRIDGE_IRR_SSRAM_GRP (BRIDGE_ISR_SSRAM_PERR | \ 6088c2ecf20Sopenharmony_ci BRIDGE_ISR_PMU_ESIZE_FAULT) 6098c2ecf20Sopenharmony_ci#define BRIDGE_IRR_PCI_GRP (BRIDGE_ISR_PCI_ABORT | \ 6108c2ecf20Sopenharmony_ci BRIDGE_ISR_PCI_PARITY | \ 6118c2ecf20Sopenharmony_ci BRIDGE_ISR_PCI_SERR | \ 6128c2ecf20Sopenharmony_ci BRIDGE_ISR_PCI_PERR | \ 6138c2ecf20Sopenharmony_ci BRIDGE_ISR_PCI_MST_TIMEOUT | \ 6148c2ecf20Sopenharmony_ci BRIDGE_ISR_PCI_RETRY_CNT) 6158c2ecf20Sopenharmony_ci 6168c2ecf20Sopenharmony_ci#define BRIDGE_IRR_GIO_GRP (BRIDGE_ISR_GIO_B_ENBL_ERR | \ 6178c2ecf20Sopenharmony_ci BRIDGE_ISR_GIO_MST_TIMEOUT) 6188c2ecf20Sopenharmony_ci 6198c2ecf20Sopenharmony_ci/* Bridge INT_DEV register bits definition */ 6208c2ecf20Sopenharmony_ci#define BRIDGE_INT_DEV_SHFT(n) ((n)*3) 6218c2ecf20Sopenharmony_ci#define BRIDGE_INT_DEV_MASK(n) (0x7 << BRIDGE_INT_DEV_SHFT(n)) 6228c2ecf20Sopenharmony_ci#define BRIDGE_INT_DEV_SET(_dev, _line) (_dev << BRIDGE_INT_DEV_SHFT(_line)) 6238c2ecf20Sopenharmony_ci 6248c2ecf20Sopenharmony_ci/* Bridge interrupt(x) register bits definition */ 6258c2ecf20Sopenharmony_ci#define BRIDGE_INT_ADDR_HOST 0x0003FF00 6268c2ecf20Sopenharmony_ci#define BRIDGE_INT_ADDR_FLD 0x000000FF 6278c2ecf20Sopenharmony_ci 6288c2ecf20Sopenharmony_ci#define BRIDGE_TMO_PCI_RETRY_HLD_MASK 0x1f0000 6298c2ecf20Sopenharmony_ci#define BRIDGE_TMO_GIO_TIMEOUT_MASK 0x001000 6308c2ecf20Sopenharmony_ci#define BRIDGE_TMO_PCI_RETRY_CNT_MASK 0x0003ff 6318c2ecf20Sopenharmony_ci 6328c2ecf20Sopenharmony_ci#define BRIDGE_TMO_PCI_RETRY_CNT_MAX 0x3ff 6338c2ecf20Sopenharmony_ci 6348c2ecf20Sopenharmony_ci/* 6358c2ecf20Sopenharmony_ci * The NASID should be shifted by this amount and stored into the 6368c2ecf20Sopenharmony_ci * interrupt(x) register. 6378c2ecf20Sopenharmony_ci */ 6388c2ecf20Sopenharmony_ci#define BRIDGE_INT_ADDR_NASID_SHFT 8 6398c2ecf20Sopenharmony_ci 6408c2ecf20Sopenharmony_ci/* 6418c2ecf20Sopenharmony_ci * The BRIDGE_INT_ADDR_DEST_IO bit should be set to send an interrupt to 6428c2ecf20Sopenharmony_ci * memory. 6438c2ecf20Sopenharmony_ci */ 6448c2ecf20Sopenharmony_ci#define BRIDGE_INT_ADDR_DEST_IO (1 << 17) 6458c2ecf20Sopenharmony_ci#define BRIDGE_INT_ADDR_DEST_MEM 0 6468c2ecf20Sopenharmony_ci#define BRIDGE_INT_ADDR_MASK (1 << 17) 6478c2ecf20Sopenharmony_ci 6488c2ecf20Sopenharmony_ci/* Bridge device(x) register bits definition */ 6498c2ecf20Sopenharmony_ci#define BRIDGE_DEV_ERR_LOCK_EN 0x10000000 6508c2ecf20Sopenharmony_ci#define BRIDGE_DEV_PAGE_CHK_DIS 0x08000000 6518c2ecf20Sopenharmony_ci#define BRIDGE_DEV_FORCE_PCI_PAR 0x04000000 6528c2ecf20Sopenharmony_ci#define BRIDGE_DEV_VIRTUAL_EN 0x02000000 6538c2ecf20Sopenharmony_ci#define BRIDGE_DEV_PMU_WRGA_EN 0x01000000 6548c2ecf20Sopenharmony_ci#define BRIDGE_DEV_DIR_WRGA_EN 0x00800000 6558c2ecf20Sopenharmony_ci#define BRIDGE_DEV_DEV_SIZE 0x00400000 6568c2ecf20Sopenharmony_ci#define BRIDGE_DEV_RT 0x00200000 6578c2ecf20Sopenharmony_ci#define BRIDGE_DEV_SWAP_PMU 0x00100000 6588c2ecf20Sopenharmony_ci#define BRIDGE_DEV_SWAP_DIR 0x00080000 6598c2ecf20Sopenharmony_ci#define BRIDGE_DEV_PREF 0x00040000 6608c2ecf20Sopenharmony_ci#define BRIDGE_DEV_PRECISE 0x00020000 6618c2ecf20Sopenharmony_ci#define BRIDGE_DEV_COH 0x00010000 6628c2ecf20Sopenharmony_ci#define BRIDGE_DEV_BARRIER 0x00008000 6638c2ecf20Sopenharmony_ci#define BRIDGE_DEV_GBR 0x00004000 6648c2ecf20Sopenharmony_ci#define BRIDGE_DEV_DEV_SWAP 0x00002000 6658c2ecf20Sopenharmony_ci#define BRIDGE_DEV_DEV_IO_MEM 0x00001000 6668c2ecf20Sopenharmony_ci#define BRIDGE_DEV_OFF_MASK 0x00000fff 6678c2ecf20Sopenharmony_ci#define BRIDGE_DEV_OFF_ADDR_SHFT 20 6688c2ecf20Sopenharmony_ci 6698c2ecf20Sopenharmony_ci#define BRIDGE_DEV_PMU_BITS (BRIDGE_DEV_PMU_WRGA_EN | \ 6708c2ecf20Sopenharmony_ci BRIDGE_DEV_SWAP_PMU) 6718c2ecf20Sopenharmony_ci#define BRIDGE_DEV_D32_BITS (BRIDGE_DEV_DIR_WRGA_EN | \ 6728c2ecf20Sopenharmony_ci BRIDGE_DEV_SWAP_DIR | \ 6738c2ecf20Sopenharmony_ci BRIDGE_DEV_PREF | \ 6748c2ecf20Sopenharmony_ci BRIDGE_DEV_PRECISE | \ 6758c2ecf20Sopenharmony_ci BRIDGE_DEV_COH | \ 6768c2ecf20Sopenharmony_ci BRIDGE_DEV_BARRIER) 6778c2ecf20Sopenharmony_ci#define BRIDGE_DEV_D64_BITS (BRIDGE_DEV_DIR_WRGA_EN | \ 6788c2ecf20Sopenharmony_ci BRIDGE_DEV_SWAP_DIR | \ 6798c2ecf20Sopenharmony_ci BRIDGE_DEV_COH | \ 6808c2ecf20Sopenharmony_ci BRIDGE_DEV_BARRIER) 6818c2ecf20Sopenharmony_ci 6828c2ecf20Sopenharmony_ci/* Bridge Error Upper register bit field definition */ 6838c2ecf20Sopenharmony_ci#define BRIDGE_ERRUPPR_DEVMASTER (0x1 << 20) /* Device was master */ 6848c2ecf20Sopenharmony_ci#define BRIDGE_ERRUPPR_PCIVDEV (0x1 << 19) /* Virtual Req value */ 6858c2ecf20Sopenharmony_ci#define BRIDGE_ERRUPPR_DEVNUM_SHFT (16) 6868c2ecf20Sopenharmony_ci#define BRIDGE_ERRUPPR_DEVNUM_MASK (0x7 << BRIDGE_ERRUPPR_DEVNUM_SHFT) 6878c2ecf20Sopenharmony_ci#define BRIDGE_ERRUPPR_DEVICE(err) (((err) >> BRIDGE_ERRUPPR_DEVNUM_SHFT) & 0x7) 6888c2ecf20Sopenharmony_ci#define BRIDGE_ERRUPPR_ADDRMASK (0xFFFF) 6898c2ecf20Sopenharmony_ci 6908c2ecf20Sopenharmony_ci/* Bridge interrupt mode register bits definition */ 6918c2ecf20Sopenharmony_ci#define BRIDGE_INTMODE_CLR_PKT_EN(x) (0x1 << (x)) 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_ci/* this should be written to the xbow's link_control(x) register */ 6948c2ecf20Sopenharmony_ci#define BRIDGE_CREDIT 3 6958c2ecf20Sopenharmony_ci 6968c2ecf20Sopenharmony_ci/* RRB assignment register */ 6978c2ecf20Sopenharmony_ci#define BRIDGE_RRB_EN 0x8 /* after shifting down */ 6988c2ecf20Sopenharmony_ci#define BRIDGE_RRB_DEV 0x7 /* after shifting down */ 6998c2ecf20Sopenharmony_ci#define BRIDGE_RRB_VDEV 0x4 /* after shifting down */ 7008c2ecf20Sopenharmony_ci#define BRIDGE_RRB_PDEV 0x3 /* after shifting down */ 7018c2ecf20Sopenharmony_ci 7028c2ecf20Sopenharmony_ci/* RRB status register */ 7038c2ecf20Sopenharmony_ci#define BRIDGE_RRB_VALID(r) (0x00010000<<(r)) 7048c2ecf20Sopenharmony_ci#define BRIDGE_RRB_INUSE(r) (0x00000001<<(r)) 7058c2ecf20Sopenharmony_ci 7068c2ecf20Sopenharmony_ci/* RRB clear register */ 7078c2ecf20Sopenharmony_ci#define BRIDGE_RRB_CLEAR(r) (0x00000001<<(r)) 7088c2ecf20Sopenharmony_ci 7098c2ecf20Sopenharmony_ci/* xbox system controller declarations */ 7108c2ecf20Sopenharmony_ci#define XBOX_BRIDGE_WID 8 7118c2ecf20Sopenharmony_ci#define FLASH_PROM1_BASE 0xE00000 /* To read the xbox sysctlr status */ 7128c2ecf20Sopenharmony_ci#define XBOX_RPS_EXISTS 1 << 6 /* RPS bit in status register */ 7138c2ecf20Sopenharmony_ci#define XBOX_RPS_FAIL 1 << 4 /* RPS status bit in register */ 7148c2ecf20Sopenharmony_ci 7158c2ecf20Sopenharmony_ci/* ======================================================================== 7168c2ecf20Sopenharmony_ci */ 7178c2ecf20Sopenharmony_ci/* 7188c2ecf20Sopenharmony_ci * Macros for Xtalk to Bridge bus (PCI/GIO) PIO 7198c2ecf20Sopenharmony_ci * refer to section 4.2.1 of Bridge Spec for xtalk to PCI/GIO PIO mappings 7208c2ecf20Sopenharmony_ci */ 7218c2ecf20Sopenharmony_ci/* XTALK addresses that map into Bridge Bus addr space */ 7228c2ecf20Sopenharmony_ci#define BRIDGE_PIO32_XTALK_ALIAS_BASE 0x000040000000L 7238c2ecf20Sopenharmony_ci#define BRIDGE_PIO32_XTALK_ALIAS_LIMIT 0x00007FFFFFFFL 7248c2ecf20Sopenharmony_ci#define BRIDGE_PIO64_XTALK_ALIAS_BASE 0x000080000000L 7258c2ecf20Sopenharmony_ci#define BRIDGE_PIO64_XTALK_ALIAS_LIMIT 0x0000BFFFFFFFL 7268c2ecf20Sopenharmony_ci#define BRIDGE_PCIIO_XTALK_ALIAS_BASE 0x000100000000L 7278c2ecf20Sopenharmony_ci#define BRIDGE_PCIIO_XTALK_ALIAS_LIMIT 0x0001FFFFFFFFL 7288c2ecf20Sopenharmony_ci 7298c2ecf20Sopenharmony_ci/* Ranges of PCI bus space that can be accessed via PIO from xtalk */ 7308c2ecf20Sopenharmony_ci#define BRIDGE_MIN_PIO_ADDR_MEM 0x00000000 /* 1G PCI memory space */ 7318c2ecf20Sopenharmony_ci#define BRIDGE_MAX_PIO_ADDR_MEM 0x3fffffff 7328c2ecf20Sopenharmony_ci#define BRIDGE_MIN_PIO_ADDR_IO 0x00000000 /* 4G PCI IO space */ 7338c2ecf20Sopenharmony_ci#define BRIDGE_MAX_PIO_ADDR_IO 0xffffffff 7348c2ecf20Sopenharmony_ci 7358c2ecf20Sopenharmony_ci/* XTALK addresses that map into PCI addresses */ 7368c2ecf20Sopenharmony_ci#define BRIDGE_PCI_MEM32_BASE BRIDGE_PIO32_XTALK_ALIAS_BASE 7378c2ecf20Sopenharmony_ci#define BRIDGE_PCI_MEM32_LIMIT BRIDGE_PIO32_XTALK_ALIAS_LIMIT 7388c2ecf20Sopenharmony_ci#define BRIDGE_PCI_MEM64_BASE BRIDGE_PIO64_XTALK_ALIAS_BASE 7398c2ecf20Sopenharmony_ci#define BRIDGE_PCI_MEM64_LIMIT BRIDGE_PIO64_XTALK_ALIAS_LIMIT 7408c2ecf20Sopenharmony_ci#define BRIDGE_PCI_IO_BASE BRIDGE_PCIIO_XTALK_ALIAS_BASE 7418c2ecf20Sopenharmony_ci#define BRIDGE_PCI_IO_LIMIT BRIDGE_PCIIO_XTALK_ALIAS_LIMIT 7428c2ecf20Sopenharmony_ci 7438c2ecf20Sopenharmony_ci/* 7448c2ecf20Sopenharmony_ci * Macros for Bridge bus (PCI/GIO) to Xtalk DMA 7458c2ecf20Sopenharmony_ci */ 7468c2ecf20Sopenharmony_ci/* Bridge Bus DMA addresses */ 7478c2ecf20Sopenharmony_ci#define BRIDGE_LOCAL_BASE 0 7488c2ecf20Sopenharmony_ci#define BRIDGE_DMA_MAPPED_BASE 0x40000000 7498c2ecf20Sopenharmony_ci#define BRIDGE_DMA_MAPPED_SIZE 0x40000000 /* 1G Bytes */ 7508c2ecf20Sopenharmony_ci#define BRIDGE_DMA_DIRECT_BASE 0x80000000 7518c2ecf20Sopenharmony_ci#define BRIDGE_DMA_DIRECT_SIZE 0x80000000 /* 2G Bytes */ 7528c2ecf20Sopenharmony_ci 7538c2ecf20Sopenharmony_ci#define PCI32_LOCAL_BASE BRIDGE_LOCAL_BASE 7548c2ecf20Sopenharmony_ci 7558c2ecf20Sopenharmony_ci/* PCI addresses of regions decoded by Bridge for DMA */ 7568c2ecf20Sopenharmony_ci#define PCI32_MAPPED_BASE BRIDGE_DMA_MAPPED_BASE 7578c2ecf20Sopenharmony_ci#define PCI32_DIRECT_BASE BRIDGE_DMA_DIRECT_BASE 7588c2ecf20Sopenharmony_ci 7598c2ecf20Sopenharmony_ci#define IS_PCI32_LOCAL(x) ((ulong_t)(x) < PCI32_MAPPED_BASE) 7608c2ecf20Sopenharmony_ci#define IS_PCI32_MAPPED(x) ((ulong_t)(x) < PCI32_DIRECT_BASE && \ 7618c2ecf20Sopenharmony_ci (ulong_t)(x) >= PCI32_MAPPED_BASE) 7628c2ecf20Sopenharmony_ci#define IS_PCI32_DIRECT(x) ((ulong_t)(x) >= PCI32_MAPPED_BASE) 7638c2ecf20Sopenharmony_ci#define IS_PCI64(x) ((ulong_t)(x) >= PCI64_BASE) 7648c2ecf20Sopenharmony_ci 7658c2ecf20Sopenharmony_ci/* 7668c2ecf20Sopenharmony_ci * The GIO address space. 7678c2ecf20Sopenharmony_ci */ 7688c2ecf20Sopenharmony_ci/* Xtalk to GIO PIO */ 7698c2ecf20Sopenharmony_ci#define BRIDGE_GIO_MEM32_BASE BRIDGE_PIO32_XTALK_ALIAS_BASE 7708c2ecf20Sopenharmony_ci#define BRIDGE_GIO_MEM32_LIMIT BRIDGE_PIO32_XTALK_ALIAS_LIMIT 7718c2ecf20Sopenharmony_ci 7728c2ecf20Sopenharmony_ci#define GIO_LOCAL_BASE BRIDGE_LOCAL_BASE 7738c2ecf20Sopenharmony_ci 7748c2ecf20Sopenharmony_ci/* GIO addresses of regions decoded by Bridge for DMA */ 7758c2ecf20Sopenharmony_ci#define GIO_MAPPED_BASE BRIDGE_DMA_MAPPED_BASE 7768c2ecf20Sopenharmony_ci#define GIO_DIRECT_BASE BRIDGE_DMA_DIRECT_BASE 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_ci#define IS_GIO_LOCAL(x) ((ulong_t)(x) < GIO_MAPPED_BASE) 7798c2ecf20Sopenharmony_ci#define IS_GIO_MAPPED(x) ((ulong_t)(x) < GIO_DIRECT_BASE && \ 7808c2ecf20Sopenharmony_ci (ulong_t)(x) >= GIO_MAPPED_BASE) 7818c2ecf20Sopenharmony_ci#define IS_GIO_DIRECT(x) ((ulong_t)(x) >= GIO_MAPPED_BASE) 7828c2ecf20Sopenharmony_ci 7838c2ecf20Sopenharmony_ci/* PCI to xtalk mapping */ 7848c2ecf20Sopenharmony_ci 7858c2ecf20Sopenharmony_ci/* given a DIR_OFF value and a pci/gio 32 bits direct address, determine 7868c2ecf20Sopenharmony_ci * which xtalk address is accessed 7878c2ecf20Sopenharmony_ci */ 7888c2ecf20Sopenharmony_ci#define BRIDGE_DIRECT_32_SEG_SIZE BRIDGE_DMA_DIRECT_SIZE 7898c2ecf20Sopenharmony_ci#define BRIDGE_DIRECT_32_TO_XTALK(dir_off,adr) \ 7908c2ecf20Sopenharmony_ci ((dir_off) * BRIDGE_DIRECT_32_SEG_SIZE + \ 7918c2ecf20Sopenharmony_ci ((adr) & (BRIDGE_DIRECT_32_SEG_SIZE - 1)) + PHYS_RAMBASE) 7928c2ecf20Sopenharmony_ci 7938c2ecf20Sopenharmony_ci/* 64-bit address attribute masks */ 7948c2ecf20Sopenharmony_ci#define PCI64_ATTR_TARG_MASK 0xf000000000000000 7958c2ecf20Sopenharmony_ci#define PCI64_ATTR_TARG_SHFT 60 7968c2ecf20Sopenharmony_ci#define PCI64_ATTR_PREF 0x0800000000000000 7978c2ecf20Sopenharmony_ci#define PCI64_ATTR_PREC 0x0400000000000000 7988c2ecf20Sopenharmony_ci#define PCI64_ATTR_VIRTUAL 0x0200000000000000 7998c2ecf20Sopenharmony_ci#define PCI64_ATTR_BAR 0x0100000000000000 8008c2ecf20Sopenharmony_ci#define PCI64_ATTR_RMF_MASK 0x00ff000000000000 8018c2ecf20Sopenharmony_ci#define PCI64_ATTR_RMF_SHFT 48 8028c2ecf20Sopenharmony_ci 8038c2ecf20Sopenharmony_cistruct bridge_controller { 8048c2ecf20Sopenharmony_ci struct resource busn; 8058c2ecf20Sopenharmony_ci struct bridge_regs *base; 8068c2ecf20Sopenharmony_ci unsigned long baddr; 8078c2ecf20Sopenharmony_ci unsigned long intr_addr; 8088c2ecf20Sopenharmony_ci struct irq_domain *domain; 8098c2ecf20Sopenharmony_ci unsigned int pci_int[8][2]; 8108c2ecf20Sopenharmony_ci unsigned int int_mapping[8][2]; 8118c2ecf20Sopenharmony_ci u32 ioc3_sid[8]; 8128c2ecf20Sopenharmony_ci nasid_t nasid; 8138c2ecf20Sopenharmony_ci}; 8148c2ecf20Sopenharmony_ci 8158c2ecf20Sopenharmony_ci#define BRIDGE_CONTROLLER(bus) \ 8168c2ecf20Sopenharmony_ci ((struct bridge_controller *)((bus)->sysdata)) 8178c2ecf20Sopenharmony_ci 8188c2ecf20Sopenharmony_ci#define bridge_read(bc, reg) __raw_readl(&bc->base->reg) 8198c2ecf20Sopenharmony_ci#define bridge_write(bc, reg, val) __raw_writel(val, &bc->base->reg) 8208c2ecf20Sopenharmony_ci#define bridge_set(bc, reg, val) \ 8218c2ecf20Sopenharmony_ci __raw_writel(__raw_readl(&bc->base->reg) | (val), &bc->base->reg) 8228c2ecf20Sopenharmony_ci#define bridge_clr(bc, reg, val) \ 8238c2ecf20Sopenharmony_ci __raw_writel(__raw_readl(&bc->base->reg) & ~(val), &bc->base->reg) 8248c2ecf20Sopenharmony_ci 8258c2ecf20Sopenharmony_ci#endif /* _ASM_PCI_BRIDGE_H */ 826