Drivers on FreeBSD

By default, FreeBSD does not load all possible drivers; it must be instructed to load the drivers specific to our hardware.


For example, for a list of unloaded drivers, we can use the following command:

root: dmesg | grep "no driver attached"

pci12: <network> at device 0.0 (no driver attached)
pci0: <multimedia, HDA> at device 27.0 (no driver attached)
pci0: <serial bus, SMBus> at device 31.3 (no driver attached)
pci9: <base peripheral, SD host controller> at device 0.1 (no driver attached)
pci9: <mass storage> at device 0.2 (no driver attached)

What stands out here: an audio chip (multimedia HDA), a network card, the WLAN in my case (network), an SMBus chipset (serial bus, SMBus) and an SD card reader.

Loading the driver of the SD card reader

root: sysrc kld_list+="mmc mmcsd sdhci"

audio

The most common audio drivers have been enabled by default since 9.0. If it doesn't, we load a "meta" driver that loads all the audio drivers, and then we look at the one that is accepted:

root: kldload snd_driver
root: cat /dev/sndstat

FreeBSD Audio Driver (newpcm: 64bit 2007061600 / amd64)

Installed devices:
pcm0: <Intel 82801H High Definition Audio Controller> at memory 0xf6dfc000 irq 21 kld snd_hda [20080420_0052] [MPSAFE] (1p: 1v / 1r: 1v channels duplex default)

In this case, the snd_hda drivers match. This driver has been included as standard in the generic kernel since version 9.0, but for an older version, loading must be declared using the old method:

root: sysrc kld_list+="snd_hda"

Or, since 9.0, adding its name to the kld_list variable in the /etc/rc.conf file.

Bluetooth

To use the loudspeakers / Bluetooth headsets, these must be transferred via the virtual_oss package. We can install the whole thing with the following command:

root: pkg inst virtual_oss virtual_oss_ctl

SMBus

We load and check whether the driver was loaded correctly:

root: kldload ichsmb

root: dmesg | grep smbus

smbus0: <System Management Bus> on ichsmb0

We add this module to the list of modules to be loaded automatically:

root: sysrc kld_list+="smbus"

ACPI-specific instructions

Very useful on laptops, there are ACPI modules that are manufacturer-specific. Here is the list of modules available on FreeBSD 11:

Module namedescription
acpi_asus.koAsus laptop extras
acpi_dock.koLaptop docking station device driver
acpi_fujitsu.koFujitsu laptop extras
acpi_hp.koACPI extras driver for HP laptops
acpi_ibm.koACPI extras driver for IBM laptops
acpi_panasonic.koACPI hotkey driver for Panasonic laptops
acpi_sony.koACPI notebook controller driver for Sony laptops
acpi_toshiba.koToshiba HCI interface
acpi_video.koACPI Video Extension's driver
acpi_wmi.koACPI to WMI mapping driver (loaded by others if necessary)

To add the variable kld_load based on our hardware. For example, for my IBM laptop I have: acpi_ibm and acpi_video.

Power saving mode

This saves the battery:

root: echo "hw.pci.do_power_nodriver=3" >> /etc/sysctl.conf