HAM_Timeout

Provides a recovery mechanism from forever-in-error conditions.

Thread Context:Blocking or Non-Blocking (based on NPA_Spawn_Thread)

Syntax

    void HAM_Timeout (
       LONG parameter
       );
    
    

Parameters

parameter
(IN) Parameter specified in NPA_Spawn_Thread when this function was scheduled. This parameter is used to assist in the timeout process.

Remarks

This function is used as a background error-recovery function. It gets scheduled for periodic entry as an asynchronous event by calling NPA_Spawn_Thread, and it executes after the elapse of the time interval specified in the clockTicks argument passed to NPA_Spawn_Thread. The time interval between iterations is left up to the HAM developer. A function scheduled with NPA_Spawn_Thread executes its thread only once. Therefore, for periodic execution, this function must, within its own context, reschedule itself by calling NPA_Spawn_Thread.

This function should be initially scheduled within the context of HAM_Load. If an I/O request or other host adapter action hangs while being processed, the HAM should not indefinitely wait to service it. Doing so could cause a forever-in-error condition from which the HAM cannot recover.

The function provides a rescue mechanism for such a condition by allowing the HAM to regain process control if the I/O is not completed in the allotted time specified in the timeoutAmount field of the HACB. The function must be able to access a list of all HACB requests that are currently being processed by devices supported by the HAM. This list must be updated each time a device completes a HACB request and accepts a new one. Each time it is executed, this function should scan the HACB list and decrement the time in each HACB's timeoutAmount field by the value specified in clockTicks. If a HACB's timeoutAmount value reaches zero, this function should

  1. Unlink the HACB from the list.
  2. Place the timeout error code (0x0002) in its hacbCompletion field.
  3. Call HAI_Complete_HACB on the HACB.

WARNING:HAM_Timeout needs to check the timeout granularity set in the HACB's controlInfo field (bit 3). From this check HAM_Timeout can determine the HACB's timeout unit of measure before blindly decrementing the value in timeoutAmount. A unit conversion might be necessary to make the units of clockTicks compatible with the units of timeoutAmount.