[kwlug-disc] unclear about PCI/USB host bus and device addressing

Robert P. J. Day rpjday at crashcourse.ca
Mon May 24 08:52:24 EDT 2010


  since i'm just about to rewrite some linux USB driver documentation,
i figure i should nail down the mechanics of PCI/USB addressing.

  starting with PCI, as i've always understood it, a full PCI address
is

  domain:bus:slot.func

where the "domain" part is irrelevant unless you have more than one
host bridge on your system.

  given that, here's some partial output of "lspci" on my laptop:

00:00.0 Host bridge: Advanced Micro Devices [AMD] RS780 Host Bridge
00:01.0 PCI bridge: Acer Incorporated [ALI] Device 9602
00:04.0 PCI bridge: Advanced Micro Devices [AMD] RS780 PCI to PCI bridge (PCIE port 0)
00:06.0 PCI bridge: Advanced Micro Devices [AMD] RS780 PCI to PCI bridge (PCIE port 2)
00:07.0 PCI bridge: Advanced Micro Devices [AMD] RS780 PCI to PCI bridge (PCIE port 3)
... snip ...
00:18.3 Host bridge: Advanced Micro Devices [AMD] Mobile K10 [Turion X2, Athlon X2, Sempron] Miscellaneous Control
00:18.4 Host bridge: Advanced Micro Devices [AMD] Mobile K10 [Turion X2, Athlon X2, Sempron] Link Control
01:05.0 VGA compatible controller: ATI Technologies Inc RS780M/RS780MN [Radeon HD 3200 Graphics]
01:05.1 Audio device: ATI Technologies Inc RS780 Azalia controller
03:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5784M Gigabit Ethernet PCIe (rev 10)
09:00.0 Network controller: Atheros Communications Inc. AR928X Wireless Network Adapter (PCI-Express) (rev 01)

  so, from the above, i'm assuming most of my devices are on PCI bus
00, but there's a PCI-PCI bridge and additional busses (none of which
i care about, i just want to clarify that).

  now back to PCI bus 0, where i can see the USB host controller(s):

...
00:11.0 SATA controller: ATI Technologies Inc SB700/SB800 SATA Controller [AHCI mode]
00:12.0 USB Controller: ATI Technologies Inc SB700/SB800 USB OHCI0 Controller
00:12.1 USB Controller: ATI Technologies Inc SB700 USB OHCI1 Controller
00:12.2 USB Controller: ATI Technologies Inc SB700/SB800 USB EHCI Controller
00:13.0 USB Controller: ATI Technologies Inc SB700/SB800 USB OHCI0 Controller
00:13.1 USB Controller: ATI Technologies Inc SB700 USB OHCI1 Controller
00:13.2 USB Controller: ATI Technologies Inc SB700/SB800 USB EHCI Controller
00:14.0 SMBus: ATI Technologies Inc SBx00 SMBus Controller (rev 3a)
...

  how do i interpret the above?  that there are two PCI slots
allocated to USB host controller(s), which means there are six host
controllers (at slots 12 and 13)?

  and how does that map to what i see from "lsusb":

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 003: ID 046d:c00e Logitech, Inc. M-BJ58/M-BJ69 Optical Wheel Mouse
Bus 005 Device 002: ID 413c:2005 Dell Computer Corp. RT7D50 Keyboard
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 005: ID 0bda:0159 Realtek Semiconductor Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root


  apparently, i have 6(?) USB busses, on which device 001 is a root
hub, and my pluggable USB devices are allocated somewhere in that
mess.  as best i can tell, each of my 2(?) USB PCI slots corresponds
to three different types of host controllers (OHCI0, OHCI1 and EHCI),
each of which is allocated its own bus.

  also, on my ubuntu 10.04 system, i can see the USB device
allocations under /dev/bus/usb:

$ find /dev/bus/usb ! -type d -exec ls -l {} \;
crw-rw-r-- 1 root root 189, 640 2010-05-24 08:21 /dev/bus/usb/006/001
crw-rw-r-- 1 root root 189, 514 2010-05-24 08:21 /dev/bus/usb/005/003
crw-rw-rw- 1 root root 189, 513 2010-05-24 08:21 /dev/bus/usb/005/002
crw-rw-r-- 1 root root 189, 512 2010-05-24 08:21 /dev/bus/usb/005/001
crw-rw-r-- 1 root root 189, 384 2010-05-24 08:21 /dev/bus/usb/004/001
crw-rw-r-- 1 root root 189, 256 2010-05-24 08:21 /dev/bus/usb/003/001
crw-rw-r-- 1 root root 189, 132 2010-05-24 08:21 /dev/bus/usb/002/005
crw-rw-r-- 1 root root 189, 128 2010-05-24 08:21 /dev/bus/usb/002/001
crw-rw-r-- 1 root root 189, 0 2010-05-24 08:21 /dev/bus/usb/001/001
$

which matches what i see from "lsusb" so that's reasonable.  and,
finally, i can probably nose around under /sys/bus/usb/devices to see
the mapping from the above to the devices themselves.

  all of that sound reasonable?  anyone want to correct my thinking?

rday

-- 

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================



More information about the kwlug-disc_kwlug.org mailing list