Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_pm.h File Reference

Go to the source code of this file.

Detailed Description

API for OCS power managment

Definition in file ocs_pm.h.

Data Structures

struct  ocs_pm_context_t
 

Enumerations

enum  ocs_pm_msg_e { OCS_PM_PREPARE = 1, OCS_PM_SLEEP, OCS_PM_HIBERNATE, OCS_PM_RESUME }
 Power State change message types. More...
 
enum  ocs_pm_state_e {
  OCS_PM_STATE_S0 = 0, OCS_PM_STATE_S1, OCS_PM_STATE_S2, OCS_PM_STATE_S3,
  OCS_PM_STATE_S4
}
 Power State values. More...
 

Functions

int32_t ocs_pm_request (ocs_t *ocs, ocs_pm_msg_e msg, int32_t(*callback)(ocs_t *ocs, int32_t status, void *arg), void *arg)
 Handle Power Management Request. More...
 
ocs_pm_state_e ocs_pm_get_state (ocs_t *ocs)
 Return driver power state. More...
 
const char * ocs_pm_get_state_string (ocs_t *ocs)
 Return driver power state as an ascii string. More...
 

Enumeration Details

Power State change message types.

Enumerator
OCS_PM_PREPARE 
OCS_PM_SLEEP 
OCS_PM_HIBERNATE 
OCS_PM_RESUME 

Definition at line 45 of file ocs_pm.h.

Power State values.

Enumerator
OCS_PM_STATE_S0 
OCS_PM_STATE_S1 
OCS_PM_STATE_S2 
OCS_PM_STATE_S3 
OCS_PM_STATE_S4 

Definition at line 56 of file ocs_pm.h.

Function Details

ocs_pm_state_e ocs_pm_get_state ( ocs_t *  ocs)

Return driver power state.

The current power state is returned. Note, that in some implementations, the power state may differ from that requested and completed using ocs_pm_request(). (SLI4 HIBERNATE requests will sleep)

Parameters
ocspointer to device structure
Returns
the current power state is returned

Definition at line 127 of file ocs_pm.c.

const char* ocs_pm_get_state_string ( ocs_t *  ocs)

Return driver power state as an ascii string.

The current power state is returned as a string.

Parameters
ocspoitner to device structure
Returns
returns power state string

Definition at line 141 of file ocs_pm.c.

int32_t ocs_pm_request ( ocs_t *  ocs,
ocs_pm_msg_e  msg,
int32_t(*)(ocs_t *ocs, int32_t status, void *arg)  callback,
void *  arg 
)

Handle Power Management Request.

Function is called by management or OS to request a change in the power state of the device controlled by the OCS driver. The API supports requesting the following:

OCS_PM_PREPARE The device (in state S0) is notified that a power state change is forthcoming. OCS_PM_SLEEP The device is transitioned to state S3 (sleep/standby). OCS_PM_HIBERNATE The device is transitioned to state S4 (hibernate) OCS_PM_RESUME The device resumes OCS_PM_CANCEL Cancel any pending request. If a callback was expected for the pending request, the callback will be made with an error status indicating the request was cancelled.

Parameters
ocspointer to device structure
msgpower manatement request message
callbackcallback function to be invoked when request has completed.
argarbitrary argument that is passed to the callback

Arguments to the callback function are as follows:

ocs pointer to device structure status integer value indicating the success or failure of the requested operation. 0 for success, negative value for failure. arg pointer to the caller supplied argument

Returns
0 for success, callback is expected 1 for success, no callback negative value for failure, no callback

For the OCS driver on the SLI4 adapters at the time of writing, SLEEP and HIBERNATE both transition to S3, assumming power on the device and memory is retained. IO's are quiesced, the port is offlined, interrupts are disabled, link is taken down. Back end calls will result, not disimilar to the bahavior of loss of link.

RESUME will bring the port back online, initiate discovery (for initiator).

Definition at line 81 of file ocs_pm.c.