[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

SYS_CFGDD sysconfig Operation

Purpose

Calls a previously loaded device driver at its module entry point.

Description

The SYS_CFGDD sysconfig operation calls a previously loaded device driver at its module entry point. The device driver's module entry point, by convention, is its ddconfig entry point. The SYS_CFGDD operation is typically invoked by device configure or unconfigure methods to initialize or terminate a device driver, or to request device vital product data.

The sysconfig subroutine puts no restrictions on the command code passed to the device driver. This allows the device driver's ddconfig entry point to provide additional services, if desired.

The parmp parameter on the SYS_CFGDD operation points to a cfg_dd structure defined in the sys/sysconfig.h file. The parmlen parameter on the sysconfig system call should be set to the size of this structure.

If the kmid variable in the cfg_dd structure is 0, the desired device driver is assumed to be already installed in the device switch table. The major portion of the device number (passed in the devno field in the cfg_dd structure) is used as an index into the device switch table. The device switch table entry indexed by this devno field contains the device driver's ddconfig entry point to be called.

If the kmid variable is not 0, it contains the module ID to use in calling the device driver. A uio structure is used to pass the address and length of the device-dependent structure, specified by the cfg_dd.ddsptr and cfg_dd.ddslen fields, to the device driver being called.

The ddconfig device driver entry point provides information on how to define the ddconfig subroutine.

The device driver to be called is responsible for using the appropriate routines to copy the device-dependent structure (DDS) from user to kernel space.

Return Values

If the SYS_CFGDD operation successfully calls the specified device driver, the return code from the ddconfig subroutine determines the value returned by this subroutine. If the ddconfig routine's return code is 0, then the value returned by the sysconfig subroutine is 0. Otherwise the value returned is a -1, and the errno global variable is set to the return code provided by the device driver ddconfig subroutine.

Error Codes

Errors detected by the SYS_CFGDD operation result in the following values for the errno global variable:

EACESS The calling process does not have the required privilege.
EFAULT The calling process does not have sufficient authority to access the data area described by the parmp and parmlen parameters provided on the system call. This error is also returned if an I/O error occurred when accessing data in this area.
EINVAL Invalid module ID.
ENODEV Module ID specified by the cfg_dd.kmid field was 0, and an invalid or undefined devno value was specified.

Related Information

The sysconfig subroutine.

The ddconfig device driver entry point.

The uio structure.

Device Configuration Subsystem Programming Introduction, Device Dependent Structure (DDS) Overview, Device Driver Kernel Extension Overview, Programming in the Kernel Environment Overview, Understanding Kernel Extension Binding, Understanding the Device Switch Table in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.


[ Previous | Next | Contents | Glossary | Home | Search ]