pci 6466透明桥配置,扫不到设备
现在6466桥片设置的是透明模式,p_vio,s_vio都是3.3,设备是正常设备。
在tornado 2.2, vxworks 5.5下,现在桥配置如下:
-> pciDeviceShow
Scanning function 0 of each PCI device on bus 0
Using configuration mechanism 0
bus device function vendorID deviceID class
00000000 00000000 00000000 00001057 00000012 000b2000
00000000 00000015 00000000 000010b5 00006540 00060400
00000000 00000016 00000000 000010b5 00006540 00060400
00000000 00000017 00000000 000010e3 00000148 00068000
value = 0 = 0x0
-> pciHeaderShow 0,0x15
vendor ID = 0x10b5
device ID = 0x6540
command register = 0x0007
status register = 0x02b0
revision ID = 0xcb
class code = 0x06
sub class code = 0x04
programming interface = 0x00
cache line = 0x08
latency time = 0x40
header type = 0x01
BIST = 0x00
base address 0 = 0x00000000
base address 1 = 0x00000000
primary bus number = 0x00
secondary bus number = 0x01
subordinate bus number = 0x01
secondary latency timer = 0x40
IO base = 0x01
IO limit = 0x81
secondary status = 0x22a0
memory base = 0x9000
memory limit = 0x9100
prefetch memory base = 0xc001
prefetch memory limit = 0xc101
prefetch memory base upper = 0x00000000
prefetch memory limit upper = 0x00000000
IO base upper 16 bits = 0x0000
IO limit upper 16 bits = 0x0000
expansion ROM base address = 0x00000000
interrupt line = 0x00
interrupt pin = 0x00
bridge control = 0x0000
value = 0 = 0x0
我访问 prefetch memory base 发现这个空间是可以访问的,但数据都是错的。
-> d 0xc0000000
c0000000: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c0000010: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c0000020: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c0000030: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c0000040: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c0000050: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c0000060: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c0000070: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c0000080: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c0000090: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c00000a0: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c00000b0: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c00000c0: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c00000d0: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c00000e0: ffff ffff ffff ffff ffff ffff ffff ffff *................*
c00000f0: ffff ffff ffff ffff ffff ffff ffff ffff *................*
value = 21 = 0x15
我用pciDeviceShow (0\1\2...255),都看了,没有设备。
希望大家帮我看看,让我的pci设备能正常运行。
[解决办法]
个人建议:
1. 如果是X86平台,建议先在windows平台下,用WinDriver之类的工具先查看一下,能不能识别,识别后的地址空间是什么样的?以前我刚接触PCI驱动开发时,就是这样整的!
2. 另外还可以联系 PCI 6466的技术支持!
[解决办法]
转发:
环境:
os:tornado2.2, vxworks5.5
cpu :ppc
桥芯片:PI7C8150B
透明桥PI7C8150B可以带8个pci设备,而21152只能带4个设备,所以选了pi7c8150.
配置过程主要是对桥的配置寄存器进行写操作。下面我给出我的大概的思路,其实桥的配置
比较复杂,我只是做了一个基本能用的。希望对你有帮助
首先:配置3个总线号。第一总线,第二总线和下级总线。
第一总线始终是我的0号总线。由于我只有两级总线因此第二总线和下级总线号都相等1
寄存器offset 0x18 4个字节按照下面的规则组织
00xxyyzzh
xx = subordinate bus number
xy = secondary bus number
zz = primary bus number
/*primary bus no,second bus no,sub bus no*/
pciConfigOutLong(PPBBusNo,PPBDeviceNo,PPBFuncNo,0x18,0x00010100);
其次,配置我们的pci空间。
我的pci空间分布: i 0xE8000000-0xE8010000 (64k)
mem: 0x80000000-0x82000000 (32M)(prefetch memory)
memi 0x82000000-0x84000000 (32M)(non-prefetch memory)
io空间的配置按照规则:
FFFFx0y0h
x = I/O limit address bits <io空间的15:12>
y = I/O base address bits <io空间的15:12>
pciConfigOutLong(PPBBusNo,PPBDeviceNo,PPBFuncNo,0x1C,0xFFFF1000);
memio 空间的配置按照规则:
***0yyy0h
*** = nonprefetchable memory limit <memio的31:20>
yyy = nonprefetchable memory base <memio的31:20>
如果不需要此空间,写值 0000FFFFh.
pciConfigOutLong(PPBBusNo,PPBDeviceNo,PPBFuncNo,0x20,0x84008200);
mem空间的配置按照规则:
***0yyy0h
*** = prefetchable memory limit address <mem的31:20>
yyy = prefetchable memory base address <mem的31:20>
如果不需要此空间,写值0000FFFFh.
pciConfigOutLong(PPBBusNo,PPBDeviceNo,PPBFuncNo,0x24,0x82008000);
第三:配置桥控制寄存器,我的板没有ISA总线
按照规则:
000x0000h
x = 0 (系统没有ISA总线)
x = 4 (系统有ISA总线)
/*Bridge control*/
pciConfigOutLong(PPBBusNo,PPBDeviceNo,PPBFuncNo,0x3C,0x00000000);
这里是一个简单的配置,更灵活的话可以参考datasheet中各位的含义。
在配置之前应该注意:
关闭memory,i/o主控制器
/*turn off all translation on bridge*/
pciConfigOutLong(PPBBusNo,PPBDeviceNo,PPBFuncNo,0x04,0xFFFF0000);
在配置之后打开
/*turn on all translation on bridge*/
pciConfigOutLong(PPBBusNo,PPBDeviceNo,PPBFuncNo,0x04,0xFFFF0007);
根据你的要求你还可以配置PCI_CFG_SEC_LATENCY
pciConfigOutByte (PPB_BUS_NO,PPB_DEV_NO,PPB_FUN_NO, PCI_CFG_SEC_LATENCY, 0x40)