Using PDIAGEX requires that serialization be used to limit access to the adapters by the diagnostics and the normal device drivers. Serialization is provided by the device configuration software.
A device state, DIAGNOSE, is defined. The state is identified by state=4 in the CuDv object for the device. A define statement:
#define DIAGNOSE 4
has been added to the /usr/include/sys/cfgdb.h file.
This state can be entered only from the DEFINED state and only by running the /usr/lib/methods/cfgdiag method. From the DIAGNOSE state, a device can be changed back to the DEFINED state only by running the /usr/lib/methods/ucfgdiag method. Transitions between the AVAILABLE and DIAGNOSE states are not allowed. This provides a mechanism for serializing access to the devices that support this DIAGNOSE state. While in the AVAILABLE state, a device's normal device driver is loaded and operational, but while it is in the DIAGNOSE state, the PDIAGEX (or separate diagnostic device driver) is loaded and has control of the device.
The /usr/lib/methods/cfgdiag method checks that the parent of the device is in the correct state. If the device is a Micro Channel adapter, it verifies that the adapter is in the slot. Busresolve then runs to ensure that bus resources are allocated properly.
Two diagnostic library routines have been created to move the device and its children to their appropriate states for testing. The routines are pdiag_diagnose_state and pdiag_restore_state.