Asynchronous Event Processing

A port driver must process the AEP_INITIALIZE, AEP_DEVICE_INQUIRY, AEP_CONFIG_DCB, and AEP_BOOT_COMPLETE functions that it receives during driver registration.

When processing the AEP_INITIALIZE function, the port driver must:

1 Allocate a DDB structure using the ISP_DDB_CREATE function of the ILB_service_rtn routine. You must allocate enough space for the members of the DDB structure and any driver-specific members needed to hold configuration information.

2 Retrieve configuration information for the device, such as IRQ and base port address, by using the configuration manager services and save this information in the corresponding members of the DDB structure.

3 Initialize the adapter hardware, if necessary.

4 Set the IRQ handler for the device using the virtual PIC services and the updated members of the DDB structure.

If the port driver completes each initialization step successfully, it returns AEP_SUCCESS. Otherwise, the driver must free the allocated DDB structure by using the ISP_DEALLOC_DDB function and return AEP_FAILURE.

When processing an AEP_DEVICE_INQUIRY function, the port driver must determine whether a drive exists for the specified drive number. If a drive does not exist, the driver must set the AEP_result member to AEP_FAILURE; otherwise, set the member to AEP_SUCCESS. The port driver will continue to receive AEP_DEVICE_INQUIRY functions until all 127 possible drive numbers have been specified or the driver sets the AEP_result member to AEP_NO_MORE-DEVICES.

When processing the AEP_CONFIG_DCB function, the port driver must insert itself into the calldown list for the DCB by using the ISP_INSERT_CALLDOWN function of the ILB_service_rtn routine. The driver must set the ISP_i_cd_req member to the address of the I/O request routine for the port driver. Subsequently, this routine is called whenever an I/O request for the device associated with the DCB is issued.

When processing the AEP_BOOT_COMPLETE function, the port driver must determine whether it successfully detected any devices it can support. If not, the driver must set the AEP_result member to AEP_FAILURE. This ensures that the port driver will be removed from memory.

A port driver should also process the AEP_IOP_TIMEOUT function. The driver should examine the given IOP structure and determine whether the IOP is one which is being processed. If it is, the driver should reset the hardware (if needed) and either retry the request or indicate an error.

Depending on whether the port driver specified additional values in the DRP_feature_code member of its DRP structure it may need to process additional asynchronous event functions.

See also AEP, DDB, DRP, ILB_service_rtn, IOP, ISP