Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15531037
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: 嵌入式

2009-09-14 10:30:19

luther@gliethttp:~$ vim /proc/bus/pci/devices
0348    11800832    12  c3100000    0   0   0   0   0   0   800     0   0   0   0   0   0    ohci1394
0349    11800822    11  c3100800    0   0   0   0   0   0   100     0   0   0   0   0   0    sdhci-pci
034a    11800843    a   c3100c00    0   0   0   0   0   0   100     0   0   0   0   0   0    ricoh-mmc
034b    11800592    a   c3101000    0   0   0   0   0   0   100     0   0   0   0   0   0   
034c    11800852    a   c3101400    0   0   0   0   0   0   100     0   0   0   0   0   0      

对该proc文件的输出源码可以直接参考linux 2.6.30.6内核drivers/pci/proc.c中show_device函数.

. 03这1个字节对应dev->bus->number表示bus编号
. 48这1个字节对应dev->devfn,这是设备编号和功能编号的一个组合,低3bits表示功能号,高5bits表示当前总线的slot插槽号
  所以
  fun=0x48 & 7=0号fun功能
  slot=0x48 >> 3=9即,第9个slot插槽.
. 1180该16bits表示vendor id
. 0832该16bits表示device id
. 12对应dev->irq表示该func功能对应的中断号
. c3100000之后都是打印出来的Base Address Register 1到Base Address Register 6内容了,
  这里的c3100000就是配置空间0x10偏移处Base Address Register 1中存放的内容,可以使用如下方式查看:
luther@gliethttp:/sys/bus/pci/devices$ xxd -g 1 0000\:03\:09.0/config
0000000: 80 11 32 08 06 01 10 02 00 10 00 0c 00 40 80 00  ..2..........@..
0000010: 00 00 10 c3 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000020: 00 00 00 00 00 00 00 00 00 00 00 00 3c 10 b5 30  ............<..0
0000030: 00 00 00 00 dc 00 00 00 00 00 00 00 0a 01 02 04  ................
. 在最后追加上driver驱动的名字drv->name

luther@gliethttp:/proc/irq$ ls
0  1  10  11  12  13  14  15  16  17  18  2  20  21  22  23  3  4  5  6  7  8  9  default_smp_affinity
luther@gliethttp:/proc/irq$ tree 18
18
|-- ohci1394
|-- smp_affinity
`-- spurious

1 directory, 2 files
luther@gliethttp:/proc/irq$

luther@gliethttp:/proc$ vim interrupts
           CPU0       CPU1      
  0:      32662    3953436   IO-APIC-edge      timer
  1:        103      10240   IO-APIC-edge      i8042
  7:          1          0   IO-APIC-edge   
  8:          0          2   IO-APIC-edge      rtc0
  9:          4       1697   IO-APIC-fasteoi   acpi
 12:          0        134   IO-APIC-edge      i8042
 14:          0          0   IO-APIC-edge      pata_amd
 15:       1209     127869   IO-APIC-edge      pata_amd
 16:       8893    1280214   IO-APIC-fasteoi   HDA Intel
 17:          0          0   IO-APIC-fasteoi   mmc0
 18:          0          3   IO-APIC-fasteoi   ohci1394
 20:      12110    1681484   IO-APIC-fasteoi   eth3
 21:        705      92190   IO-APIC-fasteoi   sata_nv
 22:       2496     274279   IO-APIC-fasteoi   ohci_hcd:usb2
 23:          0          2   IO-APIC-fasteoi   ehci_hcd:usb1
NMI:          0          0   Non-maskable interrupts
LOC:    2960013    1410386   Local timer interrupts
RES:    3027430    2768443   Rescheduling interrupts
CAL:    1448105    1314496   function call interrupts
TLB:       4788       1595   TLB shootdowns
SPU:          0          0   Spurious interrupts
ERR:          1
MIS:          0

luther@gliethttp:/sys/bus/pci/devices/0000:03:09.0$ cat vendor
0x1180
luther@gliethttp:/sys/bus/pci/devices/0000:03:09.0$ cat device
0x0832
luther@gliethttp:/sys/bus/pci/devices/0000:03:09.0$ cat class
0x0c0010
luther@gliethttp:/sys/bus/pci/devices/0000:03:09.0$ cat subsystem_device
0x30b5
luther@gliethttp:/sys/bus/pci/devices/0000:03:09.0$ cat subsystem_vendor
0x103c
luther@gliethttp:/sys/bus/pci/devices/0000:03:09.0$ cat irq
18
luther@gliethttp:/sys/bus/pci/devices/0000:03:09.0$ cat class
0x0c0010
luther@gliethttp:/sys/bus/pci/devices/0000:03:09.0$ cat resource
0x00000000c3100000 0x00000000c31007ff 0x0000000000020200
0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 0x0000000000000000

luther@gliethttp:~$ lspci
00:00.0 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)
00:00.1 RAM memory: nVidia Corporation C51 Memory Controller 0 (rev a2)
00:00.2 RAM memory: nVidia Corporation C51 Memory Controller 1 (rev a2)
00:00.3 RAM memory: nVidia Corporation C51 Memory Controller 5 (rev a2)
00:00.4 RAM memory: nVidia Corporation C51 Memory Controller 4 (rev a2)
00:00.5 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)
00:00.6 RAM memory: nVidia Corporation C51 Memory Controller 3 (rev a2)
00:00.7 RAM memory: nVidia Corporation C51 Memory Controller 2 (rev a2)
00:02.0 PCI bridge: nVidia Corporation C51 PCI Express Bridge (rev a1)
00:03.0 PCI bridge: nVidia Corporation C51 PCI Express Bridge (rev a1)
00:05.0 VGA compatible controller: nVidia Corporation C51 [Geforce 6150 Go] (rev a2)
00:09.0 RAM memory: nVidia Corporation MCP51 Host Bridge (rev a2)
00:0a.0 ISA bridge: nVidia Corporation MCP51 LPC Bridge (rev a3)
00:0a.1 SMBus: nVidia Corporation MCP51 SMBus (rev a3)
00:0a.3 Co-processor: nVidia Corporation MCP51 PMU (rev a3)
00:0b.0 USB Controller: nVidia Corporation MCP51 USB Controller (rev a3)
00:0b.1 USB Controller: nVidia Corporation MCP51 USB Controller (rev a3)
00:0d.0 IDE interface: nVidia Corporation MCP51 IDE (rev f1)
00:0e.0 IDE interface: nVidia Corporation MCP51 Serial ATA Controller (rev f1)
00:10.0 PCI bridge: nVidia Corporation MCP51 PCI Bridge (rev a2)
00:10.1 Audio device: nVidia Corporation MCP51 High Definition Audio (rev a2)
00:14.0 Bridge: nVidia Corporation MCP51 Ethernet Controller (rev a3)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:00.0 Network controller: Broadcom Corporation BCM4312 802.11a/b/g (rev 01)
03:09.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller
03:09.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 19)
03:09.2 System peripheral: Ricoh Co Ltd R5C843 MMC Host Controller (rev 0a)
03:09.3 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 05)
03:09.4 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev ff)
luther@gliethttp:~$
同样的,上面03表示bus总线号
09表示slot插槽号
0-4表示func功能号.

luther@gliethttp:/sys/bus/pci/devices$ xxd -g 1 0000\:03\:09.0/config
0000000: 80 11 32 08 06 01 10 02 00 10 00 0c 00 40 80 00  ..2..........@..
0000010: 00 00 10 c3 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000020: 00 00 00 00 00 00 00 00 00 00 00 00 3c 10 b5 30  ............<..0
0000030: 00 00 00 00 dc 00 00 00 00 00 00 00 0a 01 02 04  ................
luther@gliethttp:/sys/bus/pci/devices$ xxd -g 1 0000\:03\:09.1/config
0000000: 80 11 22 08 06 01 10 02 19 00 05 08 00 40 80 00  .."..........@..
0000010: 00 08 10 c3 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000020: 00 00 00 00 00 00 00 00 00 00 00 00 3c 10 b5 30  ............<..0
0000030: 00 00 00 00 80 00 00 00 00 00 00 00 0a 02 00 00  ................
luther@gliethttp:/sys/bus/pci/devices$ xxd -g 1 0000\:03\:09.2/config
0000000: 80 11 92 05 02 01 10 02 0a 00 80 08 00 00 80 00  ................
0000010: 00 10 10 c3 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000020: 00 00 00 00 00 00 00 00 00 00 00 00 3c 10 b5 30  ............<..0
0000030: 00 00 00 00 80 00 00 00 00 00 00 00 0a 02 00 00  ................
luther@gliethttp:/sys/bus/pci/devices$ xxd -g 1 0000\:03\:09.3/config
0000000: 80 11 52 08 02 01 10 02 05 00 80 08 00 00 80 00  ..R.............
0000010: 00 14 10 c3 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000020: 00 00 00 00 00 00 00 00 00 00 00 00 3c 10 b5 30  ............<..0
0000030: 00 00 00 00 80 00 00 00 00 00 00 00 0a 02 00 00  ................
luther@gliethttp:/sys/bus/pci/devices$ xxd -g 1 0000\:03\:09.4/config
0000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
0000010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
0000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
0000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................

阅读(4375) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~