SUNWcsu
The add_drv command is used to inform the system about newly installed device drivers.
Each device on the system has a name associated with it. This name is represented by the name property for the device. Similarly, the device may also have a list of driver names associated with it. This list is represented by the compatible property for the device.
The system determines which devices will be managed by the driver being added by examining the contents of the name property and the compatible property (if it exists) on each device. If the value in the name property does not match the driver being added, each entry in the compatible property is tried, in order, until either a match occurs or there are no more entries in the compatible property.
In some cases, adding a new driver may require a reconfiguration boot. See the NOTES section.
The following example adds the SUNW,example driver to the system, with an alias name of SUNW,alias. It assumes the driver has already been copied to /usr/kernel/drv.
example# add_drv -m ’* 0666 bin bin’,’a 0644 root sys’ \ -i ’SUNW,alias’ SUNW,example
Every minor node created by the system for the SUNW,example driver will have the permission 0666, and be owned by user bin in the group bin, except for the minor device a, which will be owned by root, group sys, and have a permission of 0644.
example# add_drv -m ’* 0666 bin bin’,’a 0644 root sys’ \ -i ’SUNW,alias’ -b /export/root/sun1 \ SUNW,example
name="display" compatible="whizzy_framebuffer", "dumb_framebuffer"
If add_drv is used to add the whizzy_framebuffer driver, the following will result.
example# add_drv whizzy_framebuffer Error: Could not install driver (whizzy_framebuffer) Device managed by another driver.
If the -v flag is specified, the following will result.
example# add_drv -v whizzy_framebuffer Error: Could not install driver (whizzy_framebuffer) Device managed by another driver. Driver installation failed because the following entries in /devices would be affected: /devices/iommu@f,e0000000/sbus@f,e0001000/display[:*] (Device currently managed by driver "dumb_framebuffer") The following entries in /dev would be affected: /dev/fbs/dumb_framebuffer0
If the -v and -f flags are specified, the driver will be added resulting in the following.
example# add_drv -vf whizzy_framebuffer A reconfiguration boot must be performed to complete the installation of this driver. The following entries in /devices will be affected: /devices/iommu@f,e0000000/sbus@f,e0001000/display[:*] (Device currently managed by driver "dumb_framebuffer" The following entries in /dev will be affected: /dev/fbs/dumb_framebuffer0
The above example is currently only relevant to devices exporting a generic device name.
add_drv returns 0 on success and 1 on failure.
It is possible to add a driver for a device already being managed by a different driver, where the driver being added appears in the device’s compatible list before the current driver. In such cases, a reconfiguration boot is required (see boot(1M) and kernel(1M) ). After the reconfiguration boot, device nodes in /devices, entries in /dev, and references to these files may no longer be valid (see the -v flag). If a reconfiguration boot would be required to complete the driver installation, add_drv will fail unless the -f option is specified. See Example 3 in the EXAMPLES section.
For this reason, it is not recommended that you use add_drv with a full pathname. See kernel(1M) for more information on the driver search path.