LinuxでUSBホストコントローラベンダーを「Linux Foundation」とリストするのはなぜですか?

LinuxでUSBホストコントローラベンダーを「Linux Foundation」とリストするのはなぜですか?

PCI / PCIEバスに接続されているUSBホストコントローラを搭載したすべてのPCで、以下を見ることができます。

$ cat /sys/bus/usb/devices/usb1/{idVendor,idProduct,manufacturer,product,serial}
1d6b
0002
Linux 4.14.157-amd64-x32 ehci_hcd
EHCI Host Controller
0000:00:1a.0

つまり、EHCIホストコントローラ(この場合はPCIデバイスの場所0000:00:1a.0)は、文字列記述子とベンダー/製品識別子の偽のセットとして表示されます。ベンダーIDを見つけて、Linux Foundationに対応していることを確認してください1d6busb.idslsusb「Linux Foundation 2.0ルートハブ」としてリストされています。)ただし、参照されているPCIデバイスは物理デバイスであり、serial次の属性を持ちます。

$ cat /sys/bus/pci/devices/0000:00:1a.0/{vendor,device}
0x8086
0x8c2d

これらのIDを調べると、pci.idsIntel 8シリーズ/ C220シリーズチップセットシリーズUSB EHCI(説明と同じ)であることがわかりますlspci。実際のハードウェアメーカーの実際のハードウェア。

それでは、LinuxはなぜこのIntelハードウェアを表すために奇妙なIDセットを使用しますか? PCIとUSBベンダー/製品IDが競合し、PCI名前空間のIDを使用してUSBデバイスツリーを起動できないことがわかります。しかし、なぜ文字列記述子ですか?

私の考えでは、「*HCIホストコントローラ」という名前の完全なUSBエンティティが仮想エンティティであるためです。ただし、そのバスに新しく接続されたデバイスには、割り当てられていないアドレス(常に= 1)があるようです。したがって、このUSBエンティティは本物である可能性があります。ただし、この予約された住所は会計の一形態にすぎません。

私の推測は正しいですか? USBオブジェクトとしてのホストコントローラは完全なフィクションですか?回線で実際のアドレス指定が可能なデバイスとして表示されませんでしたか?それとも、カーネルが単に処理をエミュレートするのではなく、実際に標準のUSBリクエストを送信できることはありますか?

ベストアンサー1

Linuxには、ホストコントローラドライバがコードを共有できるようにする抽象化があります。コメントでdrivers/usb/core/hcd.c説明する:

 * USB Host Controller Driver framework
 *
 * Plugs into usbcore (usb_bus) and lets HCDs share code, minimizing
 * HCD-specific behaviors/bugs.
 *
 * This does error checks, tracks devices and urbs, and delegates to a
 * "hc_driver" only for code (and data) that really needs to know about
 * hardware differences.  That includes root hub registers, i/o queues,
 * and so on ... but as little else as possible.
 *
 * Shared code includes most of the "root hub" code (these are emulated,
 * though each HC's hardware works differently) and PCI glue, plus request
 * tracking overhead.  The HCD code should only block on spinlocks or on
 * hardware handshaking; blocking on software events (such as other kernel
 * threads releasing resources, or completing actions) is all generic.
 *
 * Happens the USB 2.0 spec says this would be invisible inside the "USBD",
 * and includes mostly a "HCDI" (HCD Interface) along with some APIs used
 * only by the hub driver ... and that neither should be seen or used by
 * usb client device drivers.
 *

register_root_hub()この機能上記の説明に従って、USBデバイスアドレス1はのルートハブに割り当てられます。

 * register_root_hub - called by usb_add_hcd() to register a root hub
 * @hcd: host controller for this root hub
 *
 * This function registers the root hub with the USB subsystem.  It sets up
 * the device properly in the device tree and then calls usb_new_device()
 * to register the usb device.  It also assigns the root hub's USB address
 * (always 1).

これは、ベンダーIDの場合、製品ID 1、2、3がそれぞれルートハブ1.1、2.0、および3.0に対応するusb.idsことを示すデータベースによって確認されます。1d6b

このデバイスのLinuxデバイスツリーには、上記のUSB HCDフレームワークによって抽象化されたUSBホストコントローラ(実デバイス)とUSBルートハブ(物理デバイス)が混在しています。

xHCIを使用する最新のシステムには、EHCIコントローラもあります。インテル社統合料金マッチングセンターいつもついています。これらはルートハブではなく、アドレスは1ではなく2です。インテルマニュアル、5.19.1章:

The Hubs convert low and full-speed traffic into high-speed traffic.

おすすめ記事