config
Purpose
Configures system device drivers.
Synopsis
#include <sys/types.h>
#include <sys/kcfg.h>
#include <sys/ksvc.h>
Description
The config driver is used to customize the Virtual
Resource Manager (VRM) and the AIX kernel. Use of this
pseudo-device is restricted to a user with superuser
authority. Most operations are performed via ioctl
system calls. The write system calls are accepted only
in certain situations as described.
ioctl Operations
A list of ioctl calls along with the descriptions
follows. These calls return a value of 0 upon successful
completion. Otherwise, a value of -1 is returned and
errno is set to indicate the error.
If an error occurred while issuing a supervisor call
(SVC) to the VRM, errno is set to EIO. The VRM status
code is obtained using the CFRSTAT type ioctl call. In
all the following calls that pass a structure address,
the call is aborted if the structure is not entirely
within memory that is addressable by the calling process.
In that case, errno is set to EFAULT.
CFBUFF Allocates and initializes the Block I/O Commu-
nication Area (BIOCA) in kernel memory. The
arg parameter is a pointer to a defdev struc-
ture. (See CFDDEV, following, for the defi-
nition of this structure.)
If an error occurs, errno may be set to one of
the following:
EEXIST Duplicate IODN entry in block I/O
device table
ENODEV IODN not in block I/O device table
EINVAL No more room in block I/O device
table.
Note: When EINVAL is returned, the
value of the keyword maxbios (found in
/etc/master), should be changed to a
larger number and the kernel rebuilt.
CFDCODE Issues a Define_Code SVC to the VRM. The
parameter is the following structure:
struct defcode {
int iocn; /* IOCN to define */
int opts; /* options word */
int ciocn; /* IOCN to copy */
};
The options available are:
ADD_IOCN Add IOCN option
DEL_IOCN Delete IOCN option
DUP_IOCN Duplicate IOCN option.
If the option specifies deleting or duplicating
a module, the action is performed immediately.
To add a module, a single write system call
must immediately follow with the contents of
the a.out module. The VRM uses the write
buffer directly. The write buffer is cleared
when it is returned from a call. The module
must be aligned on a 2K page boundary and not
mixed with other data.
CFDDEV Configures a device in the VRM that is not a
disk partition. The parameter is a pointer to
the following structure:
struct defdev {
unsigned short iodn; /* IODN to use */
unsigned short iocn; /* IOCN to use */
unsigned short opts; /* add/delete */
unsigned short chars; /* device characteristics */
char name[4]; /* device name */
int spare;
union {
struct {
int offhc; /* offset to hdw characteristics */
int offdc; /* offset to dev characteristics */
int offras; /* offset to RAS info */
} offsets
int ddi[1]; /* device dependent info */
} ddi_data;
The options available are:
ADD_IODN Add IODN option
DEL_IODN Delete IODN option.
A Define_Device SVC is issued to the VRM using
the given data. The value is the Virtual
Machine Interface (VMI) return code.
CFQDEV Issues a Query_Device SVC to the VRM. The
parameter is a pointer to a structure of the
following form:
struct qdev {
unsigned short iodn; /* IODN to query */
unsigned short options; /* Query device options */
int length; /* length of the following */
char buffer[]; /* info returned here */
};
The options available are:
Q_HRDW Query hardware information
Q_DEV Query device information
Q_RAS Query RAS information.
After verifying the address and length of the
structure, a Query_Device SVC is issued to the
VRM with the structure given. The value
returned is the value returned from the
Query_Device SVC to the VRM.
CFRSTAT Returns the status code from the last SVC to
the VRM issued from this driver. The parameter
is ignored.
CFUDRV Configures an AIX device driver. The parameter
is a pointer to the following structure:
struct unxdrv {
dev_t devno; /* major/minor device number */
unsigned short iodn; /* IODN to set */
unsigned short ddilen; /* device dep. info byte length */
unsigned short lev; /* interrupt level */
union { /* optional device dependent info */
. . .
struct { /* for Send_Command calls */
int rv2,
rv3,
rv4,
rv5,
rv6,
} ddi_sc;
} ddi;
};
The device initialization routine for the given
driver is called with the given iodn and
device-dependent information. Some device
drivers may interpret the lev field as the VMI
interrupt level to use. (Sublevels are always
assigned dynamically by the kernel.) The value
of the CFUDRV type ioctl system call is the
value returned by the device driver initializa-
tion routine. A successful call returns a
value of 0, otherwise it returns a value of -1.
The device driver may modify the device-
dependent information that is copied back into
the structure provided by the caller of the
config driver.
If both the ddilen and iodn fields are 0, the
device initialization routine turns off the
given minor number so that future calls to open
that device will fail. If the iodn field is 0
and the ddilen field is a value other than 0,
the device driver may perform various oper-
ations not directly relating to the minor
device specified in the devno field. Device
drivers associated with device managers issue a
Send_Command SVC to the VRM device manager with
the given values rv2, rv3, rv4, rv5, and rv6 in
registers 2, 3, 4, 5, and 6. The driver waits
for the manager to return a completion or error
interrupt and overwrites the rv2, rv3, and rv4
words in the structure with data words 1, 2,
and 3 returned from the interrupt. The value
of the initialization routine is the status
code returned with the interrupt. This can be
obtained by issuing the CFRSTAT type ioctl call
previously mentioned.
CFUVRM Updates the VRM. The kernel issues an
Update_VRM SVC to the VRM. The return value is
the return code from the VMI call.
File
/dev/config
Related Information
In this book: "ioctl," "fd," "hd" and "hft."
The vrmconfig command in AIX Operating System Commands
Reference.