eeh_read_slot_state Kernel Service

Purpose

This service returns state and capabilities of a slot with respect to EEH operation.

Syntax

long eeh_read_slot_state(handle, state, support)
eeh_handle_t handle;
long *state;
long *support;

Parameters

Item Description
handle EEH handle obtained from eeh_init or eeh_init_multifunc
state State of a slot with respect to EEH
support Indicates if EEH is supported by this slot

Description

This service is used to query the hardware state of a slot and to determine whether a given slot supports EEH. It should be called to confirm an EEH event if the driver suspects that the PIO data is invalid (for example, getting all Fs from reading a register). This service returns the hardware state in state and indicates whether the slot supports EEH in support. The state and support parameters are integer values as shown below:

Valid state values are as follows:

Item Description
EEH_NSTOPPED_RST_DEA Reset deactivated and adapter is not in stopped state.
EEH_NSTOPPED_RST_ACT Reset activated and adapter is not in stopped state.
EEH_STOPPED_LS_DIS Adapter in stopped state with reset signal deactivated and Load/Store disabled.
EEH_STOPPED_LS_ENA Adapter in stopped state with reset signal deactivated and Load/Store enabled.
EEH_UNAVAILABLE Adapter is either permanently or temporarily unavailable.

Valid support values are as follows:

Item Description
0 EEH not supported.
1 EEH supported.

The driver should call this service and check for EEH_STOPPED_LS_DIS and EEH_STOPPED_LS_ENA as the state values if it suspects an EEH event on the adapter. If the state is either of those values, the slot is said to be frozen.

Single-function Driver: A single-function adapter driver calls this service to query the state of the slot. If the service fails due to hardware or firmware reasons, an error is logged. If the service fails, state and support values are undefined, and EEH_FAIL is returned.

Multifunction Driver: For a multifunction adapter driver, this service analyzes the state to determine if:

If the slot is in either a frozen or temporarily unavailable state, the EEH_DD_SUSPEND message is broadcast to all registered drivers on this slot. If the slot is permanently unavailable (that is, dead), the EEH_DD_DEAD message is broadcast. Upon receiving this message, the drivers are expected to suspend all further DMA, PIO, interrupt, configuration cycles, and so on until the slot is recovered. If the service fails due to hardware or firmware reasons, an error is logged, EEH_DD_DEAD is broadcast, and EEH_FAIL is returned.

Temporarily versus permanently unavailable state

In addition to state and support, this service also returns a valid retry_delay value in the eeh_handle structure if the state is EEH_UNAVAILABLE. If retry_delay is 0, it is permanently unavailable. If retry_delay is non-zero, it is temporarily unavailable. A permanently unavailable state means that the slot is unusable until a hot-plug operation or partition reboot is performed. Therefore, the drivers mark their adapters as unusable when they receive an EEH_UNAVAILABLE message (single-function) or when they receive an EEH_DD_DEAD message (multifunction). A temporarily unavailable state means that the current state of a slot is transient and might take a few minutes to settle down. Until that time, the device driver cannot begin recovery because it does not know what the final state will be. The temporarily unavailable state is handled differently by the single-function and multifunction drivers as follows:

Single-function Driver: Because a single-function driver drives its own recovery, it needs to check for retry_delay if the state is set to EEH_UNAVAILABLE. If retry_delay is non-zero, it represents the number of seconds that the driver should wait before calling this kernel service again. It continues to call this service repeatedly as long as the state is EEH_UNAVAILABLE and retry_delay is non-zero. Eventually, the state will end up in one of the following:

At that point, the driver can continue with its normal course of action for a given state.

Multifunction Driver: A multifunction driver does not need to check for the retry_delay field when the state is EEH_UNAVAILABLE, because EEH_UNAVAILABLE would only mean permanently unavailable. In the case of temporarily unavailable, a multifunction driver would receive the EEH_DD_SUSPEND or EEH_DD_DEAD message after some time, depending upon the final state of the slot. If the final state was EEH_NSTOPPED_RST_ACT or EEH_STOPPED_LS_DIS, then EEH_DD_SUSPEND is broadcast; if it was EEH_UNAVAILABLE, then EEH_DD_DEAD is broadcast. Thus, from the point-of-view of a multifunction driver, there is no difference between frozen and temporarily unavailable.

The macro EEH_READ_SLOT_STATE(handle, state, support) is provided for device drivers to call this service.

Execution Environment

This kernel service can be called from the process or interrupt environment.

Return Values

Item Description
EEH_SUCC Successfully read the slot state and capabilities
EEH_FAIL Unable to read the slot state and capabilities