## Recognize the utilities used to view and configure system hardware ##

[Author](authors.html): _name_ _[[contact]]_ _[[BSD_flavour]]_

[Reviewer](technical_reviewers.html): _name_ _[[contact]]_ _[[BSD_flavour]]_

[Reviewer](technical_reviewers.html): Brett Mahar brett.maharATgmailDOTcom OpenBSD 

---

### Concept ###

BSD systems come with many utilities to determine what hardware is
installed on a system. Know how to determine
which hardware was probed at boot time as well as recognize
utilities which can be used to troubleshoot and manipulate PCI, ATA,
and SCSI devices on BSD systems.


### Introduction ###

Warning: The BSDA is not required to make changes to hardware devices, but should
recognize what tools are available for this.
As noted in some of the corresponding manual pages,
some of the following utilities can cause a loss of data and/or server system crashes if
used improperly.
It is suggested that novice users stay away from some of these tools and
even expert users are encouraged to exercise caution.

On FreeBSD and DragonFly, the pciconf(8) tool can be used to read (and write) the PCI configuration register.
The -l switch lists the devices found in the boot probe and the -v option will print identification strings (if found)
for the vendor and device as found in the vendor/device information database.
(TODO: make this more understandable for novice?)
For example:

""# **pciconf -lv | tail**
""twa0@pci4:8:0:  class=0x010400 card=0x100213c1 chip=0x100213c1 rev=0x00 hdr=0x00
""    vendor   = '3ware Inc.'
""    device   = '9000 series SATA/PATA Storage Controller'
""    class    = mass storage
""    subclass = RAID
""fwohci0@pci4:11:0:      class=0x0c0010 card=0x808b1043 chip=0x8023104c rev=0x00 hdr=0x00
""    vendor   = 'Texas Instruments (TI)'
""    device   = 'TSB43AB21/A IEEE1394a-2000 OHCI PHY/Link-Layer Ctrlr'
""    class    = serial bus
""    subclass = FireWire

A similar tool on NetBSD for accessing the PCI bus is pcictl(8). For example:

""$ **pcictl pci1 list**
""001:00:0: VIA Technologies VT8623 (Apollo CLE266) VGA Controller (VGA display, revision 0x03)

OpenBSD uses `pcidump(8)` to list devices connected to the PCI bus. Calling this command with no arguments will list a one-line output for each device; with the `-v` flag, it will give further vendor/device information. The `usbdevs(8)` command works in the same way, but for devices attached to the system via USB.

FreeBSD and DragonFly provide a camcontrol(8) tool for interfacing with the CAM
(Common Access Method) system.
CAM provides a generic way to address I/O buses (such as IDE and USB) in a SCSI-like way.
The following is an example of listing all the CAM devices:

""# **camcontrol devlist**
""&lt;AMCC 9500S-4LP  DISK 2.06>        at scbus0 target 0 lun 0 (pass0,da0)
""&lt;ASUS CD-S520/A4 1.2>              at scbus3 target 0 lun 0 (pass1,cd0)

Here is an example of sending a SCSI inquiry command for the *da0* device:

""# **camcontrol inquiry da0**
""pass0: &lt;AMCC 9500S-4LP  DISK 2.06> Fixed Direct Access SCSI-3 device 
""pass0: Serial Number L500Q3LG1248DE0075FB
""pass0: 100.000MB/s transfers 

This "inquiry" can be used to check RAID volumes for example.
The camcontrol tool can "reset" devices that have become unresponsive (instead of rebooting system)
and it can also "rescan" to find new attached devices.
The camcontrol tool has numerous other features and many switches; run "camcontrol help" for details.

On FreeBSD and DragonFly systems, IDE or EIDE devices can be controlled using the atacontrol(8) utility.
It can be used to set modes (like UDMA33); delete, create, and rebuild RAID arrays; and other ATA operations.
Use "atacontrol list" to list all attached ATA devices.
The following example shows manufacturer and version information for the second device (count starts at 0):

""# **atacontrol info 1**
""Master: acd0 &lt;ASUS CD-S520/A4/1.2> ATA/ATAPI rev 0
""Slave:       no device present

This next example shows RAID details for the *ar0* device:

""# **atacontrol status ar0**
""ar0: ATA RAID1 subdisks: ad6 DOWN status: DEGRADED

### Examples ###


### Practice Exercises ###


### More information ###

dmesg(8), /var/run/dmesg.boot, pciconf(8), atacontrol(8) and camcontrol(8); pcidump(8); atactl(8) and /kern/msgbuf; scsictl(8) or scsi(8); pcictl(8), usbdevs(8)
