DDI: 8 sample driver

samp_get_config subordinate routine

samp_get_config( ) is a subordinate routine, meaning that it is called from entry point routines within the driver but not called directly by the kernel. This routine is called from both the CFG_ADD and CFG_MODIFY subfunctions to the config( ) routine, so coding it in one place enables the same code to be called from both places.

The cm_getval(D3) function is used to query the resource manager database for configuration information about this device. This function is supported for DDI versions prior to version 8, but for DDI 8 and later versions, each call to cm_getval( ) must be called as part of a read/write transaction, initiated with a call to the cm_begin_trans(D3) function and closed with a call to the cm_end_trans(D3) function. ( ) cm_getval( ) takes a single argument, which is a pointer to the cm_args(D4) structure. Before calling cm_getval( ), the cm_args structure must be populated to identify the resource manager key and resource being queried and to set up a buffer where the information will be written.

This subroutine queries the CM_IOADDR value; see the cm_params(D5) manual page for a full list of parameters that can be queried. It also saves the starting I/O address to the idata structure and verifies that enough ports are specified by ensuring that the end address is greater than the starting address. It then returns the cm_args structure to the code that called this subroutine.

Note that no lock is set before updating the idata in this subroutine. That is because the idata is already locked when this subroutine is called.

© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005