编辑: hgtbkwd | 2019-07-03 |
e) 各窗口相关的寄存器描述及窗口的作用请查阅各芯片的用户手册. 地址窗口与 CPU 的具体设计密切相关,一般由龙芯公司统一进行配置和发布. 3.3.2 窗口配置约定及示例 在窗口配置过程中,定义如下的宏对两级交叉开关进行配置:
4 #define set_Xbar_win(xbarbase,mas_i, win_i, base, mask, mmap) \ li t0, xbarbase ;
\ daddiu t0, t0, mas_i*0x100 ;
\ daddiu t0, t0, win_i*0x8 ;
\ dli t1, base ;
\ sd t1, 0x0(t0) ;
\ dli t1, mask ;
\ sd t1, 0x40(t0) ;
\ dli t1, mmap ;
\ sd t1, 0x80(t0) 对上述约定说明如下: a) 需要用到寄存器:t0,t1. b) 参数及其含义: xbarbase:交叉开关配置寄存器的基址;
mas_i:主设备号;
win_i:此主设备的窗口号(即第win_i个窗口);
base:接收地址基址;
mask:接收地址掩码;
mmap:转换后的地址基址及路由的次设备号. c) 功能:检查输入的地址是否满足过滤条件(in_addr&
mask)==base ,若满足此条件则将进来的 地址 in_addr 转换后发出去,转换规则是(in_addr&
(~mask))|mmap ;
反之则不做处理,直接 向下转发.C 代码可实现为: (in_addr&
mask)==base?out_addr=(in_addr&
(~mask))|mmap:out_addr=in_addr. 例如在LS3A2H系统中,对南桥LS2HSB的PCIE控制器(在XBAR2上的主设备上)窗口的配置如下: #PCIE window #define LS2HSB_XBAR2_BASE 0xbbd80000 #define LS2HSB_PCIE_MASTER
4 set_Xbar_win(LS2HSB_XBAR2_BASE, LS2HSB_PCIE_MASTER, 0, 0x0000000000000000, 0xffffffffc0000000, 0x00000010800000f3) # 0~1G set_Xbar_win(LS2HSB_XBAR2_BASE, LS2HSB_PCIE_MASTER, 1, 0x0000000040000000, 0xffffffffc0000000, 0x00000020800000f3) # 1~2G set_Xbar_win(LS2HSB_XBAR2_BASE, LS2HSB_PCIE_MASTER, 2, 0x0000000080000000, 0xffffffffc0000000, 0x00000030800000f3) # 2~3G set_Xbar_win(LS2HSB_XBAR2_BASE, LS2HSB_PCIE_MASTER, 3, 0x00000000c0000000, 0xffffffffc0000000, 0x00000040800000f3) # 3~4G set_Xbar_win(LS2HSB_XBAR2_BASE,4, LS2HSB_PCIE_MASTER, 0xffffffff80000000, 0xffffffffc0000000, 0x00000030800000f3) # 2~3G set_Xbar_win(LS2HSB_XBAR2_BASE,4, LS2HSB_PCIE_MASTER, 0xffffffffc0000000, 0xffffffffc0000000, 0x00000040800000f3) # 3~4G
5 例如在LS3A2H系统中,对南桥LS2HSB的IODMA控制器(在XBAR1上的主设备上)窗口的配置如下: #define LS2HSB_XBAR1_BASE 0xbbd82000 set_Xbar_win(LS2HSB_XBAR1_BASE ,
6 , 7, 0x0000000000000000, 0x0000000000000000, 0x00000000000000f0) # others, all to L2$ (默认通路 为第二个窗口,因此在使用窗口
2 之前应先将此通路备用) set_Xbar_win (LS2HSB_XBAR1_BASE ,
6 , 0, 0x0000001080000000, 0xfffffffff0000000, 0x00000000000000f6) set_Xbar_win (LS2HSB_XBAR1_BASE ,
6 , 1, 0x0000001080000000, 0xffffffffc0000000, 0x00000001000000f6) set_Xbar_win (LS2HSB_XBAR1_BASE ,
6 , 2, 0x0000002080000000, 0xffffffffc0000000, 0x00000001400000f6) set_Xbar_win (LS2HSB_XBAR1_BASE ,
6 , 3, 0x0000003080000000, 0xffffffffc0000000, 0x00000001800000f6) set_Xbar_win (LS2HSB_XBAR1_BASE ,
6 , 4, 0x0000004080000000, 0xffffffffc0000000, 0x00000001c00000f6) 可用如下方法检验配置结果: PMON>
d8 0xffffffffbbd82600
30 ffffffffbbd82600:
0000001080000000 0000001080000000 ffffffffbbd82610:
0000002080000000 0000003080000000 0... ffffffffbbd82620:
0000004080000000 000000f080000000 ffffffffbbd82630:
0000000040000000 0000000000000000 ffffffffbbd82640: fffffffff0000000 ffffffffc0000000 ffffffffbbd82650: ffffffffc0000000 ffffffffc0000000 ffffffffbbd82660: ffffffffc0000000 ffffffffff000000 ffffffffbbd82670: ffffffffc0000000
0000000000000000 ffffffffbbd82680: 00000000000000f6 00000001000000f6 ffffffffbbd82690: 00000001400000f6 00000001800000f6 ffffffffbbd826a0: 00000001c00000f6 000000fdf80000f6 ffffffffbbd826b0: 00000000000000f0 00000000000000f0 ffffffffbbd826c0: