Although busses are not devices in the usual sense, devices that represent busses are sometimes available to control selected features of the busses. Most notable are features for bus configuration.
The SCSI bus provides configuration in a form of an inquiry command. Devices are addressed using ID (0-7 or 0-15) and LUN (0-7). ID selects a device, LUN selects a logical unit within the device. Devices can communicate with each other by sending commands using command descriptor blocks. Examples of commands include Test Unit Ready (0), Sequential Read (8), Sequential Write (0Ah), Seek (0Bh), Inquiry (12h), Direct Read (28h), Direct Write (2Ah). Commands can be queued and reordered.
Each device responds to the Inquiry command.
+=====-========-========-========-========-========-========-========-========+ | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |Byte | | | | | | | | | |=====+========-========-========-========-========-========-========-========| | 0 | Operation Code: Inquiry (12h) | |-----+-----------------------------------------------------------------------| | 1 | Logical Unit Number | Reserved | EVPD | |-----+-----------------------------------------------------------------------| | 2 | Page Code | |-----+-----------------------------------------------------------------------| | 3 | Reserved | |-----+-----------------------------------------------------------------------| | 4 | Allocation Length: Inquiry Reply Length (96) | |-----+-----------------------------------------------------------------------| | 5 | Control | +=====-=======================================================================+
+=====-========-========-========-========-========-========-========-========+ | Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |Byte | | | | | | | | | |=====+========-========-========+========-========-========-========-========| | 0 | Peripheral Qualifier | Peripheral Device Type | |-----+-----------------------------------------------------------------------| | 1 | RMB | Device-Type Modifier | |-----+-----------------------------------------------------------------------| | 2 | ISO Version | ECMA Version | ANSI Version | |-----+-----------------+-----------------------------------------------------| | 3 | AENC | TrmIOP | Reserved | Response Data Format | |-----+-----------------------------------------------------------------------| | 4 | Additional Length (n-4) | |-----+-----------------------------------------------------------------------| | 5 | Reserved | |-----+-----------------------------------------------------------------------| | 6 | Reserved | |-----+-----------------------------------------------------------------------| | 7 | RelAdr | WBus32 | WBus16 | Sync | Linked |Reserved| CmdQue | SftRe | |-----+-----------------------------------------------------------------------| | 8 | (MSB) | |- - -+--- Vendor Identification ---| | 15 | (LSB) | |-----+-----------------------------------------------------------------------| | 16 | (MSB) | |- - -+--- Product Identification ---| | 31 | (LSB) | |-----+-----------------------------------------------------------------------| | 32 | (MSB) | |- - -+--- Product Revision Level ---| | 35 | (LSB) | |-----+-----------------------------------------------------------------------| | 36 | | |- - -+--- Vendor Specific ---| | 55 | | |-----+-----------------------------------------------------------------------| | 56 | | |- - -+--- Reserved ---| | 95 | | |=====+=======================================================================| | 96 | | |- - -+--- Additional Vendor Specific ---| | n | | +=====-=======================================================================+
> cat /proc/scsi/scsi Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: QUANTUM Model: ATLAS10K2-TY184L Rev: DA40 Type: Direct-Access ANSI SCSI revision: 03 Host: scsi1 Channel: 00 Id: 05 Lun: 00 Vendor: NEC Model: CD-ROM DRIVE:466 Rev: 1.06 Type: CD-ROM ANSI SCSI revision: 02 Host: scsi2 Channel: 00 Id: 00 Lun: 00 Vendor: PLEXTOR Model: DVDR PX-708A Rev: 1.02 Type: CD-ROM ANSI SCSI revision: 02
References.Â
SCSI-1 Standard.
SCSI-2 Standard.
SCSI-3 Standard.
Heiko Eißfeldt: The Linux SCSI Programming HowTo.
The PCI bus provides configuration in a form of a configuration space, which is separate from memory space and port space. Apart from the usual port read, port write, memory read, memory write commands, the C/BE signals can also issue configuration read (1010b) and configuration write (1011b) commands. Because address bus cannot be used to address devices whose address is not yet known, each slot has separate IDSEL signal which acts as CS signal for configuration read and configuration write commands.
Each device can have up to 8 independent functions, each function can have up to 64 configuration registers, the first 64 bytes are standardized. The standardized registers contain vendor ID and device ID, subsystem vendor ID and subsystem device ID, flags, memory address ranges, port address ranges, interrupts, etc.
Devices are addressed using domains (0-0FFFFh), busses (0-0FFh), slots (0-1Fh), functions (0-7). A domain typically addresses a host bridge. A bus typically addresses a bus controller, a slot typically addresses a device.
> lspci -t -[0000:00]-+-00.0 +-01.0-[0000:01]----00.0 +-02.0-[0000:02-03]----1f.0-[0000:03]----00.0 +-1e.0-[0000:04]--+-0b.0 | +-0c.0 | \-0d.0 +-1f.0 +-1f.1 +-1f.2 +-1f.3 +-1f.4 \-1f.5
The example shows a computer with one domain, which has three bridges from bus 0 to busses 1, 2 and 4, one bridge from bus 2 to bus 3, one device with six functions on bus 0, one device on bus 1, one device on bus 3, three devices on bus 4.
> lspci 00:00.0 Host bridge: Intel Corp. 82860 860 (Wombat) Chipset Host Bridge (MCH) (rev 04) 00:01.0 PCI bridge: Intel Corp. 82850 850 (Tehama) Chipset AGP Bridge (rev 04) 00:02.0 PCI bridge: Intel Corp. 82860 860 (Wombat) Chipset AGP Bridge (rev 04) 00:1e.0 PCI bridge: Intel Corp. 82801 PCI Bridge (rev 04) 00:1f.0 ISA bridge: Intel Corp. 82801BA ISA Bridge (LPC) (rev 04) 00:1f.1 IDE interface: Intel Corp. 82801BA IDE U100 (rev 04) 00:1f.2 USB Controller: Intel Corp. 82801BA/BAM USB (Hub #1) (rev 04) 00:1f.3 SMBus: Intel Corp. 82801BA/BAM SMBus (rev 04) 00:1f.4 USB Controller: Intel Corp. 82801BA/BAM USB (Hub #2) (rev 04) 00:1f.5 Multimedia audio controller: Intel Corp. 82801BA/BAM AC'97 Audio (rev 04) 01:00.0 VGA compatible controller: ATI Technologies Inc Radeon RV100 QY [Radeon 7000/VE] 02:1f.0 PCI bridge: Intel Corp. 82806AA PCI64 Hub PCI Bridge (rev 03) 03:00.0 PIC: Intel Corp. 82806AA PCI64 Hub Advanced Programmable Interrupt Controller (rev 01) 04:0b.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 78) 04:0c.0 FireWire (IEEE 1394): Texas Instruments TSB12LV26 IEEE-1394 Controller (Link) 04:0d.0 Ethernet controller: Intel Corp. 82544EI Gigabit Ethernet Controller (Copper) (rev 02)
Check the example to see what are the bridges from the previous example. Bus 1 is on board AGP going to ATI VGA, bus 2 is on board AGP going to PCI64 with APIC, bus 4 is on board PCI going to network cards.
Check the example to see what are the devices from the previous example. Device 00:1f is single chip integrating ISA bridge, IDE, USB, SMB, audio.
> lspci -vvs 04:0b.0 04:0b.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 78) Subsystem: Dell: Unknown device 00d8 Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR+ FastB2B- Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- Latency: 64 (2500ns min, 2500ns max), Cache Line Size 10 Interrupt: pin A routed to IRQ 23 Region 0: I/O ports at dc80 [size=128] Region 1: Memory at ff3ffc00 (32-bit, non-prefetchable) [size=128] Expansion ROM at ff400000 [disabled] [size=128K] Capabilities: [dc] Power Management version 2 Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+) Status: D0 PME-Enable- DSel=0 DScale=2 PME-
Check the example to see what the configuration registers reveal. The identification of the device actually says class 200h, vendor ID 10B7h, device ID 9200h, subsystem vendor ID 1028h, subsystem device ID 0D8h. This means class Ethernet, vendor 3Com, device 3C905C, subsystem vendor Dell, subsystem device unknown.
The USB bus provides configuration in a form of a device descriptor. Devices are addressed by unique addresses (0-127), communication uses message or stream pipes between endpoints. A device connect as well as supported speed is recognized electrically by a hub, which indicates a status change to the host. The host queries the hub to determine the port on which the device is connected and issues power and reset command to the hub for the port. The host assigns a unique address to the device using the default address of 0 and the default control pipe with endpoint 0 and then queries and sets the device configuration.
> lsusb -t Bus# 1 `-Dev# 1 Vendor 0x0000 Product 0x0000 `-Dev# 2 Vendor 0x046d Product 0xc01b
> lsusb Bus 001 Device 002: ID 046d:c01b Logitech, Inc. MX310 Optical Mouse Bus 001 Device 001: ID 0000:0000
> lsusb -vv -s 1:2 Bus 001 Device 002: ID 046d:c01b Logitech, Inc. MX310 Optical Mouse Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x046d Logitech, Inc. idProduct 0xc01b MX310 Optical Mouse bcdDevice 18.00 iManufacturer 1 Logitech iProduct 2 USB-PS/2 Optical Mouse iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 34 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 Remote Wakeup MaxPower 98mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 3 Human Interface Devices bInterfaceSubClass 1 Boot Interface Subclass bInterfaceProtocol 2 Mouse iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type none Usage Type Data wMaxPacketSize 0x0005 bytes 5 once bInterval 10
Check the example to see what the device descriptor reveals. The interface class HID means a human interface device, the interface subclass BOOT means a device useful at boot, the interface protocol MOUSE means a pointing device. A report descriptor would be used to describe the interface but a parser for the report descriptor is complicated. Devices useful at boot can therefore be identified from the interface class, interface subclass and interface protocol. The interrupt mentioned in the descriptor does not mean processor interrupt but interrupt transfer as one of four available transfer types for specific transfer pipe.
References.Â
Universal Serial Bus Specification 1.0.
Universal Serial Bus Specification 1.1.
Universal Serial Bus Specification 2.0.